[gambit-list] Patch to improve elementary functions for complex and exact arguments

Bradley Lucier lucier at math.purdue.edu
Thu Oct 30 18:16:47 EDT 2008


On Oct 30, 2008, at 5:06 PM, Marc Feeley wrote:

>
> Thanks Brad!  The patch is not committed to the repository.

Do you mean "not" or "now"?  I tried a "make update" on my linux box  
for testing and got

> frying-pan:~/programs/gambc-v4_3_0-devel> make update
> D       .hgignore
> D       .hgtags
> Already on branch "master"

make

etc.

> Note that your tests give slightly different results on my machine  
> (as far as I can see probably only the least significant bit is  
> different).

I reconfigured on my PPC G5 to not use the fused multiply-add  
instruction, i.e.,

[descartes:~/programs/gambc-v4_2_8] lucier% ./configure CC='gcc - 
mcpu=970 -m64 -mno-fused-madd'

and got the following differences myself.  "new-results" are what I  
sent you before, "my-results are without the fused multiply-add  
instruction:

> [descartes:~/programs/gambc-v4_2_8] lucier% diff new-results my- 
> results
> 419c419
> <       -1.5707963267948966-0.i)
> ---
> >       -1.5707963267948966-2.2737367544323206e-13i)
> 421c421
> <       -1.5707963267948966-0.i)
> ---
> >       -1.5707963267948966+2.2737367544323206e-13i)
> 457c457
> <       .7853981633974483+363.1531368262252i)
> ---
> >       .7853981633974483+363.15313682622525i)
> 459c459
> <       .7853981633974483-363.1531368262252i)
> ---
> >       .7853981633974483-363.15313682622525i)
> 495c495
> <       -.7853981633974483+363.1531368262252i)
> ---
> >       -.7853981633974483+363.15313682622525i)
> 497c497
> <       -.7853981633974483-363.1531368262252i)
> ---
> >       -.7853981633974483-363.15313682622525i)
> 1051c1051
> <      3295.836866004329-1.5707963267948966i)
> ---
> >      3295.8368660043293-1.5707963267948966i)
> 1053c1053
> <      -725.6131264718905+1.5707963267948966i)
> ---
> >      -725.6131264718906+1.5707963267948966i)
> 1055c1055
> <      -725.6131264718905-1.5707963267948966i)
> ---
> >      -725.6131264718906-1.5707963267948966i)
> 1438c1438
> <      3295.836866004329+3.141592653589793i)
> ---
> >      3295.8368660043293+3.141592653589793i)
> 1476c1476
> <      -725.6131264718905)
> ---
> >      -725.6131264718906)
> 1514c1514
> <      -725.6131264718905+3.141592653589793i)
> ---
> >      -725.6131264718906+3.141592653589793i)


So that accounts for a few of the differences. I hope we don't have  
to disable fused-madd on PPC, it speeds some things up a lot.

I believe that all the others are because of the following somewhat  
disheartening difference.

On my x86-64 linux box running Ubuntu 8.4:

> frying-pan:~> gsi
> Gambit v4.3.0
>
> > (atan 1)
> .7853981633974483
> > (sin (atan 1))
> .7071067811865475
> > (cos (atan 1))
> .7071067811865476


On my Mac G5 running 10.5.5:

> [descartes:~/programs/gambc-v4_2_8] lucier% gsi/gsi
> Gambit v4.2.9
>
> > (atan 1)
> .7853981633974483
> > (sin (atan 1))
> .7071067811865476
> > (cos (atan 1))
> .7071067811865475


Which one is correct, I don't know.  Perhaps there's a double- 
rounding going on somewhere.  (I'm glad I finally tracked this down.)

Brad



More information about the Gambit-list mailing list