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
Hi. Sorry for the late reply :P
> But the max. error in sinh/cosh/atanh is less than 2 ULP, with some math
> ibraries. It could be < 1 ULP, in theory, so sinh(atanh(x)) less than
>2 ULP even.
Sorry, but doesn't the user agree to sacrifice precision for
performance when -ffast-math is enabled?
>> The question is more like whether errno and trapping/exception behaviour
>> is identical - I guess it is not so I would expect this to be fastmath only.
>> Which particular flag one uses is a detail given there isn't a clear definition
>> for most of them.
> And signed zeroes. Yeah. I think it would have to be
> flag_unsafe_math_optimizations + some more.
>From my point of view, this optimization is OK for IEEE 754.
So I have to check if the target has signed zeroes and support signed
infinity. I will look into that.
> So we need to give Giuliano some clear guidance on guarding. This is
> out of my area of expertise, so looking to y'all to help here.
At this point I don't know how to check that, but I will look into it.
On Fri, Nov 9, 2018 at 6:03 PM Jeff Law <law@redhat.com> wrote:
>
> On 11/8/18 6:33 AM, Wilco Dijkstra wrote:
> > 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.
> So we need to give Giuliano some clear guidance on guarding. This is
> out of my area of expertise, so looking to y'all to help here.
>
> jeff