https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67531

--- Comment #2 from Pat Haugen <pthaugen at gcc dot gnu.org> ---
(In reply to Francois-Xavier Coudert from comment #1)
> Thanks for the report. So apparently, on powerpc64le-unknown-linux-gnu, long
> double division of 1.0L by 3.0L with rounding mode set to "down" is
> incorrect.
> 
> Can you compile and run the following C test case?
> 
> $ cat z.c 
> #include <fenv.h>
> #include <stdio.h>
> 
> int main (void)
> {
>   long double x1, x2, x;
> 
>   fesetround (FE_UPWARD);
>   x1 = 1;
>   x = 3;
>   x1 = x1 / x;
> 
>   fesetround (FE_DOWNWARD);
>   x2 = 1;
>   x = 3;
>   x2 = x2 / x;
> 
>   printf ("%.40Lg\n", x1);
>   printf ("%.40Lg\n", x2);
> }
> $ gcc z.c -lm && ./a.out 
> 0.3333333333333333333423683514373792036167
> 0.3333333333333333333152632971252415927665
> 
> 
> Above is the result on x86_64-linux, so the outcome shouldn't be identical,
> but the two numbers output should not be equal.

pthaugen@genoa:~$ ~/install/gcc/trunk/bin/gcc z.c -lm && ./a.out
0.3333333333333333333333333333333353876586
0.3333333333333333333333333333333292246827

Reply via email to