January 5th, 2015, 3:10 pm
QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: Traden4AlphaQuoteOriginally posted by: AVtThx. So it is to get exp correctly up to the last (binary) digit, rounded correctly (convention whatever), IEEE 754 for C (AFAIK C++ does not officially guarantee IEEE 754)Yes. My guess (and it is only a guess!) is that the polynomial approximation that they use does not converge that quickly so it's easy for the bits in the intermediate terms beyond the LSB to accumulate to change the LSB (or other low-order bits).Polynomials are not great at approximation; I would expect rational functions or continued fractions. But the compiler builders have their reasons I assume.Indeed. I would assume that various people have created various algorithms for computing exp() or pow() to the Nth bit and found that this method was fastest. But if algorithm builders start using bespoke multiplication or division algorithms, then maybe a continued fraction, rational function, or some other exotic approximation might be faster still.