3 ms·
The problem isn't in rounding or floating-point, these implementations won't be good enough to get even close to have to consider the issue of having to round c
by jensnockert 14y ago
The problem isn't in rounding or floating-point, these implementations won't be good enough to get even close to have to consider the issue of having to round correctly.
You really need to reduce the argument to a sane range, otherwise the `n' required even in infinite precision would be huge.
If someone is interested in how to do it, check out http://www.netlib.org/fdlibm/ http://www.netlib.org/fdlibm/
- ajross 14y agoIt's worth pointing out that Netlib, along with glibc, uclibc, bionic and probably the BSDs too, is just using the SunPro code from the early 90's for its trancendental functions. I'm honestly not aware of anyone who isn't. And most of these are doing more than simply reducing N in range. They typically have a transform (or three) which maps N onto a function which is very close to linear, so they can use a 5-6 term polynomial approximation to get full precision across the whole range. It's all very clever, really. But it's terribly documented (and, at this point, ruthlessly forked). I'm honestly shocked there hasn't been an effort made to clean this code up, put it into a single project and get all the divergent libm implementations using it.