Hi Jeff,

Thanks for the bug report; I'll take a look into this,

-Joe

On 9/17/2015 3:12 PM, Jeff Hain wrote:
Hi.



>At long last, I've started the port of the C version of FDLIBM (freely
>distributable math library) from C to Java, beginning with the pow method:


I ran it through tests of my math lib (jafama),
and found the following issue:

// ok
    StrictMath.pow(1.0000000000000004, 2.1E9) = 1.0000009325877754
FdLibm.Pow.compute(1.0000000000000004, 2.1E9) = 1.0000009325877754

// overflows early
    StrictMath.pow(1.0000000000000004, 2.2E9) = 1.0000009769967388
FdLibm.Pow.compute(1.0000000000000004, 2.2E9) = Infinity

// actual overflow is much further
StrictMath.pow(1.0000000000000004, 1.59828858065033216E18) = 1.7976931348621944E308
    StrictMath.pow(1.0000000000000004, 1.59828858065033242E18) = Infinity



Comparing the behavior of your code with that of Eric Blake's StrictMath
(the version I got has other issues, but not that one),
it could be corrected by replacing

if (x_abs > 1.0) {

with

if (x_abs >= 1.0000009536743164) {



After that modification, tests didn't show any difference with StrictMath.



-Jeff


Reply via email to