[PATCH 0/3] Fix powf inaccuracies up to ~169 ULP reported by Paul Zimmermann

Paul Zimmermann Paul.Zimmermann@inria.fr
Wed Sep 11 14:58:51 GMT 2024


thank you Fabian for the update.

Now I find a maximal error < 1 ulp for powf:

Checking pow with newlib-4.4.0.20231231-patched
pow 0 -1 0x1.d6411cp-102,0x1.793482p+0 [1.00] 1 0.9999999735288204

By the way I noticed that Newlib does not honor the current rounding mode in printf:

$ cat test_printf.c
#include <stdio.h>
#include <fenv.h>

int main()
{
  double x = 0.9694811147877118;
  fesetround (FE_UPWARD);
  printf ("x=%.16f upward:%.6g\n", x, x);
}

$ gcc test_printf.c -lm
$ ./a.out 
x=0.9694811147877119 upward:0.969482

$ gcc test_printf.c /localdisk/zimmerma/newlib-4.4.0.20231231/build/x86_64/newlib/libm.a 
$ ./a.out 
x=0.9694811147877118 upward:0.969481

Is that a known issue?

Paul



More information about the Newlib mailing list