Hello,

On Wed, 26 Apr 2023, Jakub Jelinek via Gcc-patches wrote:

> For glibc I've gathered data from:
> 4) using attached ulp-tester.c (how to invoke in file comment; tested
>    both x86_64, ppc64, ppc64le 50M pseudo-random values in all 4 rounding
>    modes, plus on x86_64 float/double sin/cos using libmvec - see
>    attached libmvec-wrapper.c as well)

That ulp-tester.c file as attached here is not testing what you think it 
does.  (1) It doesn't compile as it doesn't #define the TESTS macro in the 
!LIBMVEC_TEST case, and (2) it almost never progresses 'm', the status 
variable used before the random numbers start, to beyond 1: you start with 
nextafter(0.0, 1.0), which is the smallest subnormal number (with a ERANGE 
error, but that's ignored), and you test for equality with THIS_MIN, the 
smallest normal (!) number, until you start incrementing 'm'.

>From subnormal smallest to normal smallest takes 1<<mantissa-digits 
iterations, so will usually not be reached with reasonable arguments to 
ulp-tester (it will be reached for the float type with arguments beyond 
1<<24, but never for float128, and also double will take too large 
arguments to complete in reasonable time).  So the program actually only 
checks the first N subnormal values of the respective type.

I mention this before people try to use it and are super-happy about the 
accuracy of their libm's cosine :-)

(Just always incrementing m fixes the problem of course, but you probably 
intended it to do something else, maybe using __XXX_DENORM_MIN__ ?).


Ciao,
Michael.

Reply via email to