<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
The -101/1 thing, I just had the parameters reversed.<br><br>However there are at least two classes of bugs in m3_div and m3_divL.<br><br><br>1) They return the result with the wrong sign sometimes, as shown.<br><br>2) gcc 4.2 -O2 on my Mac causes the existing functions to raise<br>a signal, presumably divide by zero, where without -O2 does not.<br><br>I'll be fixing both shortly, and including test code.<br>The test code will show that without optimization, I get the same<br>results for various inputs, except that I fix the sign sometimes.<br>Similar with gcc 4.0.1 -O2.<br>This is all on Darwin/x86.<br>I'll test out some other variations.<br>This will also fix the warnings under -O2 -Wstrict-overflow=4 or such.<br><br><br> - Jay<br><br><hr id="stopSpelling">From: jay.krell@cornell.edu<br>To: m3devel@elegosoft.com<br>Date: Sun, 17 Jan 2010 05:10:10 +0000<br>Subject: [M3devel] bugs in hand.c division<br><br>



<style>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</style>


The division functions in hand.c sometimes have the wrong sign on the result.<br><br>jbook2:Common jay$ ./a.out<br>-2147483648 / -2147483647 = old:-1, new:1<br>-2147483648 / -1073741824 = old:-2, new:2<br>-2147483648 / -1073741823 = old:-2, new:2<br>-2147483648 / -1073741825 = old:-1, new:1<br>-2147483648 / -10 = old:-214748364, new:214748364<br>-2147483648 / -9 = old:-238609294, new:238609294<br>-2147483648 / -8 = old:-268435456, new:268435456<br>-2147483648 / -7 = old:-306783378, new:306783378<br>-2147483648 / -6 = old:-357913941, new:357913941<br>-2147483648 / -5 = old:-429496729, new:429496729<br>-2147483648 / -4 = old:-536870912, new:536870912<br>-2147483648 / -3 = old:-715827882, new:715827882<br>-2147483648 / -2 = old:-1073741824, new:1073741824<br><br>I'll be fixing this shortly.<br>It occurs without any optimizations.<br><br>There is another bug I don't understand yet.<br>m3_divL(101/-1) is -1 but m3_div(101/-1) is the correct -101.<br><br>I think I'm also seeing optimization alter the results<br>but I have to look closer.<br><br> - Jay<br>                                          </body>
</html>