standards/175811: libstdc++ needs complex support in order use C99

Bruce Evans brde at
Thu May 30 16:52:38 UTC 2013

On Thu, 30 May 2013, Warner Losh wrote:

> I'm all for getting everything we can into the tree that produces an answer that's not perfect, but close. What's the error that would be generated with the naive implementation of
> long double tgammal(long double f) { return tgamma(f); }

On x86, 11 low bits wrong, for an error of 2048 ulps, in addition to any
errors in tgamma().  tgamma() on i386 inherits errors of 9 peta-ulps
(all 53 bits wrong) from i387 trig functions, but is OK on small args on
i386 and better on large args on amd64.

On sparc64, 60 low bits wrong, for an error of 1 exa-ulp, in addition
to any errors in tgamma(); the latter are the same as on amd64.  Sparc64
users of long double precision pay for it with a loss of performance
of a factor of several hundred, so they should be unhappy to not get
he extra bits when they ask for them (but the above inaccurate version
doesn't give them what they asked for).

On arches with long double == double, no difference.

On i386 with the default rounding precision of double, little difference.

> But assuming that, for some reason, produces errors larger than difference in precision between double and long double due to extreme non-linearity of these functions, having only a couple of stragglers is a far better position to be in than we are today.

Such extra errors normally don't happen.  In fact, my accuracy tests for
double functions are essentially to upcast the results of double functions
and compare the resulting bits with the corresponding results for long
double functions.  Nonlinearities tend to only happen at zeros and poles
of functions and then they are due to bugs, and for NaNs, and then they are 
due to implementation-defined behaviour.  It is difficult to even determine
the location of zeros and poles for some functions, and most of the
complexities in libm are to uses especially careful calculations near
them when they are known.


More information about the freebsd-standards mailing list