incorrectly rounded square root

Maciej W. Rozycki macro@orcam.me.uk
Sat Jun 12 22:31:32 GMT 2021


On Fri, 4 Jun 2021, Jeff Johnston wrote:

> The compiler is optimizing out the rounding check in ef_sqrt.c, probably
> due to the operation using two constants.

 Have you checked the `-frounding-math' option to GCC?  This piece of code 
(as probably all newlib's math pieces) ought to be built with that option, 
and if that still does not help (which it may well, as noted in the GCC 
manual), then would you please file a bug with GCC, attaching the test 
case discussed here as a reproducer?

 FWIW glibc does use said option, which may be why seemingly equivalent 
code works with glibc but not with newlib.

 HTH,

  Maciej


More information about the Newlib mailing list