[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Conflicts between C standard and 754-2008

Nick Maclaren wrote:
On Jan 1 2011, Michel Hack wrote:
Unless I couldn't figure out how to use fesetround(FE_TOWARDZERO),

Without assuming anything about your C competence, you are aware that
FENV_ACCESS must be 'on' over BOTH the '#include <stdlib.h>' AND the
use of strtod(), aren't you?

I was not aware of that -- but it makes no difference.  Not surprising,
as I could not find any reference to FENV_ACCESS in a recursive grep
of /usr/include -- and, in any case, fegetenv() worked and showed a
status_word of 0xC00, which matches the x86 definition of FE_TOWARDZERO,
so the fesetround() did work.

Oh (having Googled FENV_ACCESS), I see:  it's a #pragma, not a macro.
I tried that too ("#pragma STDC FENV_ACCESS ON" as mentioned in the
references I had found) -- again, no difference.

There *is* perhaps an issue of compiler options; I did not use any,
as there are too many to choose from, and I have no clue.  x86-64 has
several different FP engines -- SSE, x87, ... and so perhaps there are
different rounding modes and status words involved...

Others have since confirmed that glibc ignores current rounding mode.

---Sent: 2011-01-02 17:27:35 UTC

754 | revision | FAQ | references | list archive