Francois Grieu <fg****@micronet.fr> writes:
In ISO/IEC 9899:1999, it is unambiguous that floor(-0.5)
has the value -1 (converted to double).
Was this the case in earlier C standards?
C90 says:
The floor function returns the largest integral value not greater
than x, expressed as a double.
C99 says:
The floor functions return |_ x _|, expressed as a floating-point number.
where "|_" and "_|" are my crude rendition of the mathematical symbol
for the floor function.
Is anyone aware of an implementaton that has it wrong ?
I'm not -- and given that the function is called "floor", getting it
wrong (say, by rounding towards 0.0) would be a pretty dumb mistake.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"