This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add sinh(tanh(x)) and cosh(tanh(x)) rules
- From: Giuliano Augusto Faulin Belinassi <giuliano dot belinassi at usp dot br>
- To: Jeff Law <law at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Paul Koning <paulkoning at comcast dot net>
- Date: Wed, 17 Oct 2018 18:25:44 -0300
- Subject: Re: [PATCH] Add sinh(tanh(x)) and cosh(tanh(x)) rules
- References: <CAEFO=4C+BLJYGHNwuCbjdeY2Xj5KJkBeRRCKmSxqTUqwVokkag@mail.gmail.com> <1a9f1bf8-cb6a-41e3-e13f-d7743bc16dcb@redhat.com> <CAEFO=4BGUTJ0d58Z-MP6yPOOm+DS6gVL7-C0Bg_H0KiVA8ZF7Q@mail.gmail.com> <6315400f-4ee5-2402-2808-7c6cb04b71d6@redhat.com>
> Hmm, do we have problems as we get close to -1 or 1 where the outputs of
> the two forms might diverge?
Well, I did some minor testing with that with input x around nextafter(1, -1);
There are a minor imprecision when comparing directly with
sinh(atanh(x)) and cosh(atanh(x)).
* On 32-bits floats, for such x the error is about 10^-4
* On 64-bits floats, for such x the error is about 10^-7
* On 80-bits floats, for such x the error is about 10^-9
here are the code that I used for the test: https://pastebin.com/JzYZyigQ
I can create a testcase based on this if needed :-)