Link Search Menu Expand Document

roundup

Explanation Rounds up to the specified digit.

If the digit position to be rounded up is positive, it will be rounded up to the specified digit after the decimal point.
If the digit position to be rounded up is negative, the integer part is rounded up to the specified digit.
When the digit position to be rounded up is omitted, the number after the decimal point is rounded up.

Rounding up the roundup function (when the number of digits = 0) will be the smallest (negative direction) of integers greater than or equal to the value
*Added since Version 2.0.0*
Call format var r = roundup( arg, n )
Return value Returns a number rounded up to the specified digit.
Arguments Number arg Original number
Number n Position of the girder to round up
Exception None
Example of use
print(roundup(12345.678, -2)); /* 12400となる */
print(roundup(12345.678));     /* 12346となる */
print(roundup(12345.678, 2));  /* 12345.68となる */
 
print(roundup(0.50));  /* 1となる */
print(roundup(-0.50)); /* 0となる */
Related item round, rounddown, roundm methods