Path: utzoo!attcan!uunet!husc6!mailrus!iuvax!pur-ee!uiucdcs!uxc.cso.uiuc.edu!uicsrd.csrd.uiuc.edu!petersen From: petersen@uicsrd.csrd.uiuc.edu Newsgroups: comp.sys.amiga Subject: PDC math library Message-ID: <42600024@uicsrd.csrd.uiuc.edu> Date: 15 Jun 88 20:46:00 GMT Lines: 39 Nf-ID: #N:uicsrd.csrd.uiuc.edu:42600024:000:1664 Nf-From: uicsrd.csrd.uiuc.edu!petersen Jun 15 15:46:00 1988 I started out using the portable math library that Fred Fish had posted to the next a while back, but when I ran the Savage benchmark I found out that the version I was using was missing quite a bit in the accuracy department. I did a little research and found out about the CORDIC algorithms for the elementry functions and rewrote the basic functions using this method. CORDIC functions require a table of atan(), and atanh() values which Macsyma was happy to provide to the required precision (I think I over-did this part because all of the table values are accurate to 32 digits). After fixing more of the floating point bugs in PDC and compiling the new basic functions I reran the Savage benchmark. This time the numbers were getting closer but are still not as good as the sun math library. The main problem is that the CORDIC routines I wrote need a few guard digits to throw away but I can't get the extra digits using the standard double type. I was hoping to be able to get closer to the ~16|17 digits of precision that is capable of the IEEE double format. the value of 'a' = 2.50000000000993960469E+003 As you can see I'm only getting about ~11|12 digits of precision. Does any one have any ideas to make the library routines a little more accurate. Or is speed more important than accuracy (If so I should go back to the old routines, not very accurate but fairly fast). -Paul Petersen -------------------------------- extern double tan(), atan(), exp(), log(), sqrt(); main() { int i; double a; a = 1.0; for (i = 0; i < 2499; i++) a = tan(atan(exp(log(sqrt(a*a))))) + 1.0; printf( "the value of 'a' = %24.20e\n", a ); }