On Fri, 29 Jun 2001, John Peacock wrote:

> Peter Prymmer wrote:
> > 
> >  not ok 1145
> >  # Test 1145 got: '-176544' (lib/Math/BigInt/t/bigintpm.t at line 359)
> >  #      Expected: '23456'
> 
> That is this pair of tests:
> 
> ###############################################################################
> # bug in sub where number with at least 6 trailing zeros after any op
> failed
> 
> $x = Math::BigInt->new(123456); $z = Math::BigInt->new(10000); $z *= 10;
> $x -= $z;
> ok ($z, 100000);
> ok ($x, 23456);
> 
> So I guess that would point the finger at "-=" which is apparently 
> subtracting 300000 from $x!
> 
> Peter, could you change that to:
> 
>       $x = $x - $z;
> 
> and see if you get the same answer?  I cannot see anything in the code

I do see the same answer:

$ diff -u lib/Math/BigInt/t/bigintpm.t lib/Math/BigInt/t/bigintpm.t_john
--- lib/Math/BigInt/t/bigintpm.t        Tue Jun 26 06:28:22 2001
+++ lib/Math/BigInt/t/bigintpm.t_john   Fri Jun 29 11:05:34 2001
@@ -354,7 +354,8 @@
 # bug in sub where number with at least 6 trailing zeros after any op failed

 $x = Math::BigInt->new(123456); $z = Math::BigInt->new(10000); $z *= 10;
-$x -= $z;
+# $x -= $z;
+$x = $x - $z;
 ok ($z, 100000);
 ok ($x, 23456);

$ ./perl -Ilib lib/Math/BigInt/t/bigintpm.t_john > bigint.out_1
$ diff bigint.out_0 bigint.out_1
1147c1147
< # Test 1145 got: '-176544' (lib/Math/BigInt/t/bigintpm.t at line 359)
---
> # Test 1145 got: '-176544' (lib/Math/BigInt/t/bigintpm.t_john at line 360)



> and see if you get the same answer?  I cannot see anything in the code
> which would explain why you are getting that error.  It certainly has
> small enough values to be stored in a conventional int.  I am not
> seeing a failure here under Cygwin.

This sounds a bit disheartening :-{

Peter Prymmer


Reply via email to