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

Re: Conflicts between C standard and 754-2008

On Sat, Jan 1, 2011 at 5:38 PM, Michel Hack <hack@xxxxxxxxxxxxxx> wrote:
Unless I couldn't figure out how to use fesetround(FE_TOWARDZERO), it
appears that Linux (with gcc version 4.3.2) strtod() does not honour
the rounding direction at all:

  <175: 74 => ./td 0.1 1
  rc from fesetround(rm): 0  rm=3072
  td: 3FB99999 9999999A      3 status=0000  0.1

  <175: 82 => uname -r -m x86_64

(The same program under AIX returns ...999 for TOWARDZERO
and ...99A for NEAREST, as expected.  It does however return
Infinity for overflow regardless of rounding mode, guided by
the not-yet-revised C standard.)

---Sent: 2011-01-01 22:41:33 UTC

glibc does not honor the rounding mode, as I wrote about recently: http://www.exploringbinary.com/visual-c-plus-plus-and-glibc-strtod-ignore-rounding-mode/ .

754 | revision | FAQ | references | list archive