Hi,

> I checked it. They are all the same on x86_64:
> https://pastebin.com/e63FxDAy
> I even forced to call the glibc sinh and atanh, but use the sqrtsd 
> instruction.
> But I do agree that there may be an arch that sets an errno for sinh
> or cosh but not for sqrt, implying in a unexpected behavior.
> Is the no-math-errno really necessary?

Thanks for the code, that was quite useful. When using errno it is actually
necessary to reset errno before every math function since it otherwise contains
an incorrect value from a different math call. When I do that I get:

before:  = -nan
after :  = -nan
before:  = -nan
after :  = -nan
before:  = nan
after :  = nan
before:  = -0.0000000000e+00
after :  = -0.0000000000e+00
before:  = 0.0000000000e+00
after :  = 0.0000000000e+00
before:  = inf
after :  = inf
Errno changed 34 0
before:  = nan
after :  = nan
before:  = nan
after :  = nan
before:  = nan
after :  = nan

So NaNs, signed zeroes, infinities all work perfectly indeed, and it's just 
errno that
isn't set in the same way for the infinite case. That means that checking for 
errno
in addition to unsafe-math would be good, unless unsafe-math already allows 
incorrect
setting of errno.

Wilco
    

Reply via email to