Rounding options

Many functions in errorverse packages like scrutiny have a rounding argument that controls how numbers are rounded. Specify rounding as any of the strings below.

In the errorverse

These options return two rounded numbers for each input number. In consistency tests, this means counting a value set as consistent if the reported number matches either of the two rounded reconstructed numbers.

By contrast, these options only return one rounded number per input:

Rounding at 5 in other software

If the decimal portion to be cut off by rounding is 5, how do these technologies round?

Note on rounding to even

Rounding to the next even number is not reliable. The fundamental facts of floating-point computation imply that results may vary in unpredictable ways. See this explanation of base::round(), or a more general article about the limits of floating-point arithmetic.


  1. Excel’s naming is inconsistent with roundwork’s usage. For instance, ROUNDUP() always rounds to the higher number, which is called ceiling in roundwork (and in more common parlance). However, roundwork’s notion of "up" relies on a shared understanding with the user that numbers will only be rounded up from 5, not from any lower value; likewise with "down". This is arguably suboptimal: compare roundwork::round_up() to the more explicit naming of janitor::round_half_up().↩︎