incorrectly rounded square root

Paul Zimmermann Paul.Zimmermann@inria.fr
Mon Jun 7 09:51:35 GMT 2021


> Great catch, analysis, and fix!
> Now sqrtf rounds correctly on Cygwin!

thank you, I also confirm I now get expected results, after applying Jeff's
patch on top of Newlib 4.1.0:

zimmerma@tomate:/tmp$ gcc -frounding-math -I/tmp/x86_64/include -DNEWLIB -fno-builtin test_sqrt_2.c /tmp/x86_64/lib/libm.a 
zimmerma@tomate:/tmp$ ./a.out 
RNDN: 0x1.ff83fp+63 cw=895 mxcsr=8064
RNDZ: 0x1.ff83eep+63 cw=3967 mxcsr=32672
RNDU: 0x1.ff83fp+63 cw=2943 mxcsr=24480
RNDD: 0x1.ff83eep+63 cw=1919 mxcsr=16288

zimmerma@tomate:/tmp$ gcc -frounding-math -fno-builtin test_sqrt_2.c -lm
zimmerma@tomate:/tmp$ ./a.out 
RNDN: 0x1.ff83fp+63 cw=895 mxcsr=8064
RNDZ: 0x1.ff83eep+63 cw=3967 mxcsr=32672
RNDU: 0x1.ff83fp+63 cw=2943 mxcsr=24480
RNDD: 0x1.ff83eep+63 cw=1919 mxcsr=16288

Paul



More information about the Newlib mailing list