[M3devel] bugs in hand.c division

Jay K jay.krell at cornell.edu
Sun Jan 17 06:10:10 CET 2010


The division functions in hand.c sometimes have the wrong sign on the result.

jbook2:Common jay$ ./a.out
-2147483648 / -2147483647 = old:-1, new:1
-2147483648 / -1073741824 = old:-2, new:2
-2147483648 / -1073741823 = old:-2, new:2
-2147483648 / -1073741825 = old:-1, new:1
-2147483648 / -10 = old:-214748364, new:214748364
-2147483648 / -9 = old:-238609294, new:238609294
-2147483648 / -8 = old:-268435456, new:268435456
-2147483648 / -7 = old:-306783378, new:306783378
-2147483648 / -6 = old:-357913941, new:357913941
-2147483648 / -5 = old:-429496729, new:429496729
-2147483648 / -4 = old:-536870912, new:536870912
-2147483648 / -3 = old:-715827882, new:715827882
-2147483648 / -2 = old:-1073741824, new:1073741824

I'll be fixing this shortly.
It occurs without any optimizations.

There is another bug I don't understand yet.
m3_divL(101/-1) is -1 but m3_div(101/-1) is the correct -101.

I think I'm also seeing optimization alter the results
but I have to look closer.

 - Jay
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100117/5881e0f4/attachment-0002.html>


More information about the M3devel mailing list