Rounding rules and notations
Rounding.
Previously: 211018-1510 Python rounding behaviour with TL;DR that python uses banker’s rounding, with .5th rounding towards the even number.
-
Floor/ceil have their usual latex notation as
\rceil
,\rfloor
(see LaTeX/Mathematics - Wikibooks, open books for an open world at ‘delimiters’) -
“Normal” rounding (towards nearest integer) has no standard notation: ceiling and floor functions - What is the mathematical notation for rounding a given number to the nearest integer? - Mathematics Stack Exchange
- $\lfloor3.54\rceil$ is one notation people mention
- Some suggest $[3.54]$ but most hate this because overused
- $nint(3.45)$ (’nearest integer function’) works
let XXX denote the standard rounding function
-
Bankers’ rounding (that python and everyone else use for tie-breaking for normal rounding and .5) has no standard notation as well
Let $\lfloor x \rceil$ denote "round half to even" rounding (a.k.a. "Banker's rounding"), consistent with Python's built-in round() and NumPy's np.round() functions.
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus