Re: Weird constant folding of __builtin_remainder() with -frounding-math

2013-11-20 Thread Marc Glisse
On Wed, 20 Nov 2013, Marc Glisse wrote: On Wed, 20 Nov 2013, FX wrote: I reduced my problem to the following code: int main (void) { double x; x = 1 / 3.; __builtin_printf ("%.30lg %.30lg\n", __builtin_remainder(1., 1/3.), 1/3.); __builtin_printf ("%.30lg %.30lg\n", __builtin_remainder(1

Re: Weird constant folding of __builtin_remainder() with -frounding-math

2013-11-20 Thread FX
> Did you really test on x86_64-linux? I am only seeing this -2.71e-20 when > using -mfpmath=387. Duh, you’re right: I tested on a x86_64-linux, but whose system compiler (4.7.2) actually defaults to 32-bit. FX

Re: Weird constant folding of __builtin_remainder() with -frounding-math

2013-11-20 Thread Marc Glisse
On Wed, 20 Nov 2013, FX wrote: I reduced my problem to the following code: int main (void) { double x; x = 1 / 3.; __builtin_printf ("%.30lg %.30lg\n", __builtin_remainder(1., 1/3.), 1/3.); __builtin_printf ("%.30lg %.30lg\n", __builtin_remainder(1., x), x); } This calls __builtin_remaind

Weird constant folding of __builtin_remainder() with -frounding-math

2013-11-20 Thread FX
I reduced my problem to the following code: int main (void) { double x; x = 1 / 3.; __builtin_printf ("%.30lg %.30lg\n", __builtin_remainder(1., 1/3.), 1/3.); __builtin_printf ("%.30lg %.30lg\n", __builtin_remainder(1., x), x); } This calls __builtin_remainder() twice, once with constant