FreeBSD Bugzilla – Attachment 251488 Details for
Bug 277783
libc fma() doesn't not return the correct zero sign
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
testcase for long double
test3.c (text/plain), 1.41 KB, created by
Steve Kargl
on 2024-06-16 02:08:22 UTC
(
hide
)
Description:
testcase for long double
Filename:
MIME Type:
Creator:
Steve Kargl
Created:
2024-06-16 02:08:22 UTC
Size:
1.41 KB
patch
obsolete
>#include <fenv.h> >#include <math.h> >#include <stdio.h> >#include "mpfr.h" > >void >test_ldbl(long double xf, long double yf, long double zf) >{ > long double rf, rr; > mpfr_t rm, xm, ym, zm; > > mpfr_inits2(64, rm, xm, ym, zm, NULL); > > mpfr_set_ld(xm, xf, MPFR_RNDN); > mpfr_set_ld(ym, yf, MPFR_RNDN); > mpfr_set_ld(zm, zf, MPFR_RNDN); > > printf( "ldbl (x,y,z): % La % La % La\n", xf, yf, zf); > mpfr_printf("mpfr (x,y,z): % Ra % Ra % Ra\n", xm, ym, zm); > > fesetround(FE_TONEAREST); > rf = fmal(xf, yf, zf); > mpfr_fma(rm, xm, ym, zm, MPFR_RNDN); > rr = mpfr_get_ld(rm, MPFR_RNDN); > printf("RNDN: % La % La\n", rr, rf); > > fesetround(FE_UPWARD); > rf = fmal(xf, yf, zf); > mpfr_fma(rm, xm, ym, zm, MPFR_RNDU); > rr = mpfr_get_ld(rm, MPFR_RNDU); > printf("RNDU: % La % La\n", rr, rf); > > fesetround(FE_TOWARDZERO); > rf = fmal(xf, yf, zf); > mpfr_fma(rm, xm, ym, zm, MPFR_RNDZ); > rr = mpfr_get_ld(rm, MPFR_RNDZ); > printf("RNDZ: % La % La\n", rr, rf); > > fesetround(FE_DOWNWARD); > rf = fmal(xf, yf, zf); > mpfr_fma(rm, xm, ym, zm, MPFR_RNDD); > rr = mpfr_get_ld(rm, MPFR_RNDD); > mpfr_printf("RNDD: % La % La\n\n", rr, rf); >} > >int >main(void) >{ > long double x = 0x1p-8200L, y = 0x1p-8260L, z = 0x1p-16400L; > long double a, b, c; > > a = x - y; > b = x + y; > c = -z; > > test_ldbl(-1., 1., 1.); >// test_ldbl( 1., -1., 1.); >// test_ldbl(-1., -1., -1.); > > > test_ldbl(a, b, c); > > return (0); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 277783
:
249266
|
251421
| 251488 |
251489