From: Warren Brown Date: 2003-09-03T07:49:10+09:00 Subject: [PATCH] RE: BigDecimal Bugs Bret, > irb(main):001:0> require 'bigdecimal' > true > irb(main):002:0> a = BigDecimal.new("1")/BigDecimal.new("0") > # > irb(main):003:0> b = -a > # > irb(main):004:0> c = -b > # > irb(main):005:0> a == b > false > irb(main):006:0> b == c # ?!! > true This looks like a bug in bigdecimal.c at line 2046. This patch should fix it: --- bigdecimal.c Fri Aug 1 02:08:43 2003 +++ bigdecimal.c.new Tue Sep 2 17:45:00 2003 @@ -2043,7 +2043,7 @@ return 0; } if(VpIsInf(a)) { - VpSetInf(c,isw); + VpSetInf(c,isw*VpGetSign(a)); return 0; } I know you have already fixed the negative infinity display bug, but for completeness, here is the patch: --- bigdecimal.h Fri Aug 1 02:08:43 2003 +++ bigdecimal.h.new Tue Sep 2 17:45:00 2003 @@ -26,7 +26,7 @@ #define SZ_NaN "NaN" #define SZ_INF "Infinity" #define SZ_PINF "+Infinity" -#define SZ_NINF "+Infinity" +#define SZ_NINF "-Infinity" /* * #define VP_EXPORT other than static to let VP_ routines I hope this helps. - Warren Brown