Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Mar 2024 19:50:31 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 277783] libc fma() doesn't not return the correct zero sign
Message-ID:  <bug-277783-227-587dxzCYX7@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-277783-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-277783-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D277783

--- Comment #2 from Steve Kargl <kargl@FreeBSD.org> ---
So, I don't loose a reduced version of the code:

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

int
main(void)
{
    volatile double x =3D 0x1p-500, y =3D 0x1p-550, z =3D 0x1p-1000;
    double a, b, c, r;

    a =3D x-y;
    b =3D x+y;
    c =3D -z;
    r =3D fma(a, b, c);
    /*
     * Should print -0 instead of +0.
     */
    printf("fma(%+a, %+a, %+a) =3D %+g\n", a, b, c, r);

    return 0;
}

% cc -o z -O3 a.c -lm && ./z
fma(+0x1.ffffffffffff8p-501, +0x1.0000000000004p-500, -0x1p-1000) =3D +0

% cc -o z -O3 a.c -mfma -lm && ./z
fma(+0x1.ffffffffffff8p-501, +0x1.0000000000004p-500, -0x1p-1000) =3D -0

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-277783-227-587dxzCYX7>