The IEEE floating-point format defines four different rounding modes.
- It’s the default mode
It first attempts to find a closest match. Thus, it rounds 1.40 to 1 and 1.60 to 2,
If it falls halfway, it rounds the number either upward or downward such that the least significant digit of the result is even (Which in most case means even).
- It will round upward about 50% of the time and round downward about 50% of the time.
Round-toward-zero mode rounds positive numbers downward and negative numbers upward
Round-down mode rounds both positive and negative numbers downward
Round-up mode rounds both positive and negative numbers upward