Truncation rounds negative numbers upwards, and positive numbers downwards. Floor rounds all numbers downwards, and ceiling rounds all numbers upwards. Is there a term/notation/whatever for the fourth operation, which rounds negative numbers downwards, and positive numbers upwards? That is, one which maximizes magnitude as truncation minimizes magnitude?
Asked
Active
Viewed 551 times
1 Answers
3
The fourth operation is called "round towards infinity" or "round away from zero". It can be implemented by
$$y=\text{sign} (x)\text{ceil}(|x|)$$
Matt L.
- 10,636
-
1And as a side note, truncation is sometimes called round towards zero. – Brian M. Scott Jun 13 '13 at 10:33