RFR: 8265768 [aarch64] Use glibc libm impl for dlog, dlog10, dexp iff 2.29 or greater on AArch64.
Andrew Haley
aph at redhat.com
Tue May 25 09:04:34 UTC 2021
On 5/24/21 7:50 PM, gregcawthorne wrote:
> On Thu, 15 Apr 2021 08:33:47 GMT, gregcawthorne <github.com+73799211+gregcawthorne at openjdk.org> wrote:
>
> I have been reading up on the monotonicity paper suggested by Andrew Haley:
> [http://www-leland.stanford.edu/class/ee486/doc/ferguson1991.pdf](url)
>
> In order to try and see if I can prove the current glibc
> implementations of log and exp, for monotonicity.
>
> However, I have come to the conclusion that the paper
> calculates the relative error threshold for monotonicity for an
> approximation, and then relies on extra bits of floating-point
> hardware precision to be guaranteed monotonic. These extra bits
> of precision are greater than the target representations
> mantissa bits, which when subsequently rounded at the
> end (rounding is semi monotonic), leads to a monotonic
> implementation. No extra bits of floating-point precision are
> present in AArch64 in-between floating-point operations and so
> this paper won't help us in this case.
Indeed. I'm looking at some other references, and e.g. Muller,
Elementary Functions, provides an example that needs 2 guard bits
to round monotonically in the case of sin(x). I'm not sure that
it's possible to do the final rounding step in a way that
guarantees monotonicity without some guard bits. I can't find
anything that provides a way to do so.
[ One thing: Java uses the term "semi-monotomic" to
mean "whenever the mathematical function is non-decreasing, so is
the floating-point approximation, likewise, whenever the
mathematical function is non-increasing, so is the floating-point
approximation." I don't really understand what distinction means. ]
> If the remez polynomial of fdlibm isn’t definitively proven to be
> monotonic, and the glibcs remez polynomials has comparable
> accuracy. Then it might suffice to attempt to investigate further
> the effects of the table lookup method implementation; with regards
> to semi-monotonicity, even if it wouldn’t offer a total proof of the
> overall implementation.
Maybe so. In OpenJDK, Joe Darcy has done more work in this area than
anyone else, and we should get him involved.
--
Andrew Haley (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
More information about the hotspot-dev
mailing list