Rounding Away from Zero #
Away-from-zero rounding uses ceiling on nonnegative inputs and floor on negative inputs. Together with toward-zero rounding, it supplies the second endpoint decomposition for arbitrary valid integer rounding modes.
Integer rounding away from zero.
Instances For
Away-from-zero agrees with floor on negative inputs.
Away-from-zero agrees with ceiling on nonnegative inputs.
On nonpositive inputs, away-from-zero agrees with floor, including at zero.
Away-from-zero rounding is monotone and fixes integers.
theorem
TorchLean.Floats.neural_valid_round_eq_trunc_or_away
(rnd : ℝ → ℤ)
[NeuralValidRnd rnd]
(x : ℝ)
:
Arbitrary valid integer rounding chooses toward-zero or away-from-zero.
theorem
TorchLean.Floats.neuralRound_away_point
{β : NeuralRadix}
{fexp : ℤ → ℤ}
[NeuralValidExp fexp]
(x : ℝ)
:
Generic away-from-zero rounding satisfies its semantic point specification.