<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
sorry, that wasn't right. But there were problems with Microsoft Visual C++ and Sun cc, and gcc.<BR>
 <BR>
 - Jay<BR><BR> <BR>
<HR id=stopSpelling>
From: jay.krell@cornell.edu<BR>To: m3devel@elegosoft.com<BR>Date: Sun, 17 Jan 2010 07:19:56 +0000<BR>Subject: Re: [M3devel] bugs in hand.c division<BR><BR>
<STYLE>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</STYLE>
Visual C++ and Sun cc also had problems here.<BR>Visual C++ only had LONG_MIN / LONG_MIN wrong, optimized or not.<BR>  -1 vs 1.<BR>Sun cc same as gcc: LONG_MIN divided by negative wrong, unless optimized.<BR>Anyone feel free to confirm my findings, please. :)<BR>(likewise with INT64_MIN)<BR> <BR> - Jay<BR><BR> <BR>
<HR id=ecxstopSpelling>
From: jay.krell@cornell.edu<BR>To: m3devel@elegosoft.com<BR>Date: Sun, 17 Jan 2010 05:48:42 +0000<BR>Subject: Re: [M3devel] bugs in hand.c division<BR><BR>
<STYLE>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</STYLE>
(Of course I'll have to look into the mod functions as well. :) )<BR><BR> - Jay<BR><BR><BR>
<HR id=ecxecxstopSpelling>
From: jay.krell@cornell.edu<BR>To: m3devel@elegosoft.com<BR>Date: Sun, 17 Jan 2010 05:46:09 +0000<BR>Subject: Re: [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 -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=ecxecxecxstopSpelling>
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>