S
Szabolcs
After a little experimentation I see that with the g++ compiler on x86,
when a double is converted to an int, the fractional part is discarded.
Examples:
int(0.7) == 0
int(1.3) == 1
int(-1.3) == -1
Is this behaviour consistent between different platforms? Is the result
of these operations defined by the standard, or should one use functions
like ceil() and floor() (and check for negative values) instead?
when a double is converted to an int, the fractional part is discarded.
Examples:
int(0.7) == 0
int(1.3) == 1
int(-1.3) == -1
Is this behaviour consistent between different platforms? Is the result
of these operations defined by the standard, or should one use functions
like ceil() and floor() (and check for negative values) instead?