round2 function

Round a given number, with 5 always rounded up

Round a given number, with 5 always rounded up

Given a number and a digit to round to, returns the rounded number, with 5 always rounded upwards.

round2(x, n)

Arguments

  • x: the data to be rounded
  • n: the number of digits to round to

Details

This function differs from round, which rounds 5 "towards the even number". Rounding 5s up leads to bias when positive and negative numbers are expected, but can be desired in some cases.

  • Maintainer: Eric C. Anderson
  • License: CC0
  • Last published: 2024-01-24

Useful links