https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67531
--- Comment #5 from Pat Haugen <pthaugen at gcc dot gnu.org> --- (In reply to Francois-Xavier Coudert from comment #3) > How about with this? I'm trying to come as close as possible to the exact > sequence of fe.etround() calls as the Fortran front-end and runtime library > would end up performing… > > > #include <fenv.h> > #include <stdio.h> > > int main (void) > { > int r; > long double x1, x2, x; > > x1 = 1; > x = 3; > r = fegetround (); > fesetround (FE_UPWARD); > x1 = x1 / x; > fesetround (r); > > x2 = 1; > x = 3; > r = fegetround (); > fesetround (FE_DOWNWARD); > x2 = x2 / x; > fesetround (r); > > printf ("%.40Lg\n", x1); > printf ("%.40Lg\n", x2); > } pthaugen@genoa:~$ ~/install/gcc/trunk/bin/gcc junk.c -lm && ./a.out 0.3333333333333333333333333333333353876586 0.3333333333333333333333333333333292246828