In libm, sin(qNaN) doesn't expect FE_INVALID ?

Ruinland ChuanTzu Tsai ruinland@andestech.com
Thu Sep 10 13:49:01 GMT 2020


Hi Dr. Myers,
thanks again for your detailed letter :-)

If you could bear with a little more, I have a final quetsion and would
like to have someone to discuss with - -

I'm a little bit confused by the implementation of ULPDIFF() inside
`math/libm-test-support.c` which is :

```
#define ULPDIFF(given, expected) \                                                                                                                            (FUNC(fabs) ((given) - (expected)) / ulp (expected)
```

and it looks _not_ really the same as the formula inside glibc's docu-
mentation [1] :
` |d.d...d - (z / 2^e)| / 2^(p - 1) `

( For a number z with the representation d.d…d·2^e and p is the number
of bits in the mantissa of the floating-point number representation. )

The denominator part of these two seems to have different meaning ?

Besides this issue, I would like to know that is there any written
policy for loosening or tightening the ULPs for mathematic functions ?
For instance, the libm-test-ulps for i386 has varied several times.
Yet I cannot find concrete discussions about making the precission
check either more strict or tolerant.

And if someone is introducing a new platform to glibc, are there any
rules to regulate ? e.g. "ccosh" mustn't have a ulp more than ......

Really appreciate your kindness,
Ruinland ChuanTzu Tsai

[1] https://www.gnu.org/software/libc/manual/html_node/Errors-in-Math-Functions.html


More information about the Libc-alpha mailing list