On Fri, Jul 08, 2005 at 10:20:03AM -0700, Devon H. O'Dell wrote: > Wanted to ping the list to see if anybody is working on putting some of > the C99 math functions (complex numbers, anything else that's missing) > into the tree. If not, are there any reasons I shouldn't work on doing this? > See freebsd-standard mailing list archive. I have implementations of the long double versions of acoshl, asinhl, atanhl, cabsl, cbrtl, hypotl, log10l, logl, and sqrtl. I also have implementations of log2 and log2f. After some email exchanges with David Schultz and bde, it became apparent that I need to at least redo sqrtl and cbrtl. In particular, sqrtl needs to meet the requirements of IEEE-754. Of the functions I list, logl and sqrtl are the most important to get right because the remaining functions rely on these in some fashion. In logl (and some of the others), I use Taylor series expansions with an appropriate truncation to achieve the required accuracy. David and bde have both pointed out that an optimal polynomial approximation, based on Remes' algorithm, would be preferred, so I've spent the last several days learning about this approach. You can grab a snapshot of what I have at http://troutmask.apl.washington.edu/~kargl/libm-20050708.tar.gz Some points on my code. On i386 the significand is 53 bit while on amd64 it is 64 bit for long double. You need to be aware of this difference. I have a test program, c99math, that generates random numbers in the valid ranges of asinh, acosh, atanh, log10l, logl, and sqrtl functions to test the implementation. It uses GMP/MPFR to compute exact values for float, double, and long double data types. Also, note that c99math does a fuzzy comparison because of rounding on the last decimal digit. I should probably do the comparison on the binary representation of the numbers, but I haven't got that far in my hacking. -- SteveReceived on Fri Jul 08 2005 - 16:54:56 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:38 UTC