Why do most C compilers poxily round towards zero ?

Dik T. Winter dik at cwi.nl
Fri Oct 12 11:25:23 AEST 1990


In article <1990Oct11.161737.10969 at zoo.toronto.edu> henry at zoo.toronto.edu (Henry Spencer) writes:
 > In article <SHIRONO.90Oct10114447 at gcx1.ssd.csd.harris.com> shirono at ssd.csd.harris.com writes:
 > >It is important to understand that, in type demotion, C doesn't round
 > >either way; it simply eliminates that which it cannot use.
 > 
 > This is a form of rounding (although not a very useful one).  There are
 > half a dozen different rounding algorithms; "rounding" is not a precise
 > term referring to one and only one.
I tend to disagree, but this may be quibbling.  Rounding is a very precise
term.  You may round a floating point value to an integer, or a real number
to a floating point value.  That is what rounding does: giving less
precision.  But as Henry Spencer notes: there are several rounding
algorithms (cf. IEEE).
--
dik t. winter, cwi, amsterdam, nederland
dik at cwi.nl



More information about the Comp.lang.c mailing list