This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add sinh(tanh(x)) and cosh(tanh(x)) rules

Hi Wilco,

On Thu, Nov 08, 2018 at 01:33:19PM +0000, Wilco Dijkstra wrote:
> > 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...

Sure.  My point is that there can be math libraries where the original
sinh(atanh(x)) is more precise than what we replace it with here, for
certain values at least.  So you need some fast math flag no matter what.

But we agree on that anyway :-)

> So you have to measure ULP error since it is quite counter intuitive.

It's hard to measure with DP, and worse with QP...  Proving things is
often easier.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]