[gambit-list] fix to ##acos

Bradley Lucier lucier at math.purdue.edu
Mon Aug 11 09:26:09 EDT 2008


On Aug 11, 2008, at 1:14 AM, Bradley Lucier wrote:

> Gambit now "fails" 4 tests (2 for acos, 2 for asin) due to  
> "catastrophic
> cancellation" for very large arguments.  I don't know how to fix  
> them at
> the moment, or, indeed, whether they're worth fixing:
>
> frying-pan:~/programs/gambc-v4_2_3/snd-9/tools> ../../gsi/gsi test.scm
> ;(asin 1234000000.+0.i) got 0.+inf.0i, but expected 1.5707963267949 
> +21.62667394298955i
> ;(asin -1234000000.-0.i) got -0.-inf.0i, but expected  
> -1.5707963267949+21.62667394298955i
> ;(acos 1234000000.+0.i) got 1.5707963267948966-inf.0i, but expected  
> 0.-21.62667394298955i
> ;(acos -1234000000.-0.i) got 1.5707963267948966+inf.0i, but  
> expected 3.14159265358979-21.62667394298955i
> ;all done!

The test suite is generated by a C program; the test generator  
calculates the expected results using the C math library on whatever  
machine it's run on.

When run on my PowerPC MacOS X 10.4.11 box, the above tests are  
generated; gambit with my suggested change to ##acos fails them on  
both my x86-64 linux box and on my PPC Mac.

When run on my x86-64 linux box, different tests are generated;  
gambit with my suggested change passes them on both my x86-64 linux  
box and on my PPC Mac.

There is still a problem (gambit's results shown above are not  
correct), but I'm not sure it's worth fixing.

Brad



More information about the Gambit-list mailing list