However, there are six different ways that a C implementation could choose to implement number formatting, five of which are documented in IEEE-754:
* Round towards 0
* Round towards +inf
* Round towards -inf
* Round towards nearest, ties to even
* Round towards nearest, ties away from 0
* Truncate decimal representation
It occurs to me that truncating the decimal representation is actually equivalent to rounding towards 0, so that's only five after all and all of them are documented. Wasn't thinking about that.
/s/ Adam
Not for negative numbers.
Yes for negative numbers. If you write -1.23456, and you truncate that representation (e.g. to -1.23), then you have rounded towards zero.
Besides, if it WERE different for negative numbers, then it would be equivalent to rounding towards -inf instead, which would still mean it's not a distinct rounding mode.
/s/ Adam