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: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>
- Cc: Jeff Law <law at redhat dot com>, Richard Biener <richard dot guenther at gmail dot com>, Giuliano Augusto Faulin Belinassi <giuliano dot belinassi at usp dot br>, GCC Patches <gcc-patches at gcc dot gnu dot org>, "giuliano dot belinassi at gmail dot com" <giuliano dot belinassi at gmail dot com>, nd <nd at arm dot com>
- Date: Thu, 8 Nov 2018 13:33:19 +0000
- Subject: Re: [PATCH] Add sinh(tanh(x)) and cosh(tanh(x)) rules
- References: <DB5PR08MB103001D43201E2827778B49F83E30@DB5PR08MB1030.eurprd08.prod.outlook.com> <CAEFO=4CV1P23fmb_kAv8u=ubJ5PejVFC59gFGnbNm2TrO-P38Q@mail.gmail.com> <20181019134511.GA1712@gate.crashing.org> <CAEFO=4ApmEcpd-7ou2-_mdvMdGT4qphYdVcuZwpwYD=QvrDOeQ@mail.gmail.com> <DB5PR08MB1030FF50545C033B42839E2B83F90@DB5PR08MB1030.eurprd08.prod.outlook.com> <CAEFO=4CFeyjbRK5itK3ieb5mgEHtcEMSYd70cO4OgtWD2hcjpw@mail.gmail.com> <5b717a08-f994-0de8-5092-d11f5d9f8bd0@redhat.com> <DB5PR08MB1030D79DBDD463F20156413183C40@DB5PR08MB1030.eurprd08.prod.outlook.com>,<20181108014316.GQ5994@gate.crashing.org>
Hi,
> But the max. error in sinh/cosh/atanh is less than 2 ULP, with some math
> libraries. It could be < 1 ULP, in theory, so sinh(atanh(x)) less than
> 2 ULP even.
You can't add ULP errors in general - a tiny difference in the input can
make a huge difference in the result if the derivative is > 1.
Even with perfect implementations of 0.5000001ULP on easy functions with
no large derivatives you could get a 2ULP total error if the perfectly rounded
and actual result end up rounding in different directions in the 2nd function...
So you have to measure ULP error since it is quite counter intuitive.
> And signed zeroes. Yeah. I think it would have to be
> flag_unsafe_math_optimizations + some more.
Indeed.
Wilco