March 15th, 2013, 11:31 am
QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: Traden4AlphaQuoteOriginally posted by: Cuchulainn....!! max == 0.0002441 These errors seem unavoidable due to round-off in different algorithms and the large numbers being bandied about, no?exp(sqrt(200))^2 = 1.92 e12. And an error of 0.0002441 in 1.92 e12 is about 1 part in 2^53 which is about the LSB on a double.Double trouble, what?-----------Perhaps the more interesting question is which variant is closer to the truth?I don't want to tempt fate but in general;t*t is the same as pow(t,2) but pow(t, 2.0) is out by a miniscule margin.Perhaps an old but interesting man page might be still valid today. QuoteERROR (due to Roundoff etc.) exp(x), log(x), expm1(x) and log1p(x) are accurate to within an ulp, and log10(x) to within about 2 ulps; an ulp is one Unit in the Last Place. The error in pow(x,y) is below about 2 ulps when its magnitude is moderate, but increases as pow(x,y) approaches the over/underflow thresholds until almost as many bits could be lost as are occupied by the floating-point format's exponent field; 11 bits for double. No such drastic loss has been exposed by testing; the worst errors observed have been below 300 ulps for double. Moderate values of pow are accurate enough that pow(integer,integer) is exact until it is bigger than 2**53 for double.Who wrote pow() and what compromises did they use to make it "good enough"?