2

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?

Sneftel
  • 760

1 Answers1

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