------- Comment #4 from sgk at troutmask dot apl dot washington dot edu 2007-01-13 06:09 ------- Subject: Re: Evaluate complex math functions at compile-time
On Sat, Jan 13, 2007 at 05:17:11AM -0000, ghazi at gcc dot gnu dot org wrote: > > ------- Comment #3 from ghazi at gcc dot gnu dot org 2007-01-13 05:17 ------- > > Yes, but think of the waste of creating all these complex functions > only to hide them inside GCC. In a perfect world, these would exist > inside MPFR or MPC and I'd have more confidence they'd have less bugs. Well, mpfr doesn't have a complex type, and you've already broached the possible negative effect of requiring another 3rd party library to build GCC. From watching the mailing lists, you already caught enough crap for using mpfr. I still don't understand why so many people got bent out of shape. > Sigh, in the real world I guess it'll have to be a one-off for GCC > and hope I don't hose all the corner cases. I'm not a wiz at this > exact precision calculation hooha. Hopefully someone will stop me > before I shoot myself. :-) You don't have to be a whiz. IEEE 754 requires exact results for only sqrt() for floating point types. For all other libm functions one strives for results that are correct to less than or equal to 0.5 ULP. The most important item is a good understand of complex analysis and in particular branch cuts (see the glibc csqrt bug). Another thing to note, mpfr returns the correct result to whatever precision you requested. Internally, mpfr may, and often does, compute that result with much higher precision. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30447