[Bug math/14471] Inaccurate y0f function

zimmerma+gcc at loria dot fr sourceware-bugzilla@sourceware.org
Sun Feb 2 22:01:00 GMT 2020


https://sourceware.org/bugzilla/show_bug.cgi?id=14471

--- Comment #4 from Paul Zimmermann <zimmerma+gcc at loria dot fr> ---
here is the worst case found by exhaustive search on all binary32 values with
glibc 2.31 on x86_64:

#include <stdio.h>
#include <math.h>
#include <fenv.h>

extern float y0f(float);
extern double y0(double);

int main() {
    float a,r1;
    double r2;

    a=0x25c54.84p0;    //argument

    fesetround(FE_TONEAREST); // FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, and
FE_TOWARDZERO

    r1 = y0f(a);  //actual result
    r2 = y0(a);   //actual result 2

    printf("inputs: a = %.6a\n", a);
    printf("actual    = %.6a\n", r1);
    printf("expected  = %.6a\n", r2);
    printf("error     = %f ulp\n", fabs(r1 - r2) * exp2(23.0-logbf(r2)));
    return 0;
}

inputs: a = 0x1.2e2a42p+17
actual    = -0x1.c21d2ep-30
expected  = 0x1.a48974p-40
error     = 15117099194.163063 ulp

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list