Thread overview
[Issue 23677] log1p Documentation Doesn't Match Implementation
Feb 27, 2023
Iain Buclaw
Feb 27, 2023
John Hall
Feb 27, 2023
John Hall
Mar 20, 2023
John Hall
February 27, 2023
https://issues.dlang.org/show_bug.cgi?id=23677

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
February 27, 2023
https://issues.dlang.org/show_bug.cgi?id=23677

--- Comment #1 from John Hall <john.michael.hall@gmail.com> ---
It looks like my previous comment about CEPHES is in error. What is actually happening is that the logImpl function has the CEPHES polynomials that are used for log1p (at least I know it's true for doubles, I don't see them in the CEPHES code for floats/long double, but I assume it is right).

In other words, the phobos log function seems to try to be more accurate for values close to 1 in a way that is different from other programming languages (which is why log1p is typically included as a separate function).

I'm still showing some funky results for log1p(1.0e-15) vs. log1p(1.0e-16)
compared to when log1p did the calculation at real accuracy.

--
February 27, 2023
https://issues.dlang.org/show_bug.cgi?id=23677

--- Comment #2 from John Hall <john.michael.hall@gmail.com> ---
I double-checked and log1p doesn't provide the same accuracy as the CEPHES implementation for doubles.

--
March 20, 2023
https://issues.dlang.org/show_bug.cgi?id=23677

John Hall <john.michael.hall@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from John Hall <john.michael.hall@gmail.com> ---
By the time of the 2.102.2 release, the precision was properly increased for log1p.

--