n
decimals or to the nearest non-zero decimal place, if rounding to n
yields zero.Returns the rounded number to the n
decimals or to the nearest non-zero decimal place,
if rounding to n
decimals yields zero. The default for n
is 2.
Function is borrowed from this
link.
my_round(x, n = 2)
The rounded number to n
decimals, and if this is zero to the nearest nonzero decimal
A real number on which rounding will be applied
Number of decimal places to round the number. If rounding yields 0, it rounds to the nearest non-zero decimal place.
Elvan Ceyhan
a=17; b=35
my_round(a/b)
my_round(b/a)
my_round(12.5624)
my_round(-0.64010)
my_round (0.000026)
my_round(-0.00072451)
Run the code above in your browser using DataLab