floting-point => integral conversions and rounding

uunet!netcom.com!segfault!rfg uunet!netcom.com!segfault!rfg
Tue Dec 21 01:05:54 PST 1993


There's been a discussion recently in the comp.lang.c++ newsgroup regarding
what happens when a floating-point value is converted into an integral
value.

Much to my surprize, I found that the ISO C standard and the IEEE 754
standard are in direct conflict regarding what is supposed to happen for
such conversions.

The C standard says that "...the fractional part is discarded."  (I think
that may be just a bit ambiguous in the case of negative numbers... but
we'll just pass on that for the moment.)

Anyway, the IEEE 754 standard says that the default rounding which must
apply to such conversions is "round to nearest".

Is it just me, or does this direct conflict bother anybody else?


-- R. F. Guilmette, Sunnyvale, CA -------- RG Consulting -------------------
---- domain addr: rfganetcom.com ----------- Purveyors of Compiler Test ----
---- uucp addr: ...!uunet!netcom!rfg ------- Suites and Bullet-Proof Shoes -



More information about the Numeric-interest mailing list