Link Search Menu Expand Document

rounddown

Explanation Truncate at the specified digit.

If the number of digits is positive, the digits after the decimal point are truncated.
If the number of digits is negative, the integer part is truncated at the specified digit.
When the digit is omitted, the number after the decimal point is truncated.

Rounddown of the rounddown function (when the number of digits = 0) will be Maximum (positive direction) of integers less than or equal to the value
*Added since Version 2.0.0*
Call format var r = rounddown( arg, n )
Return value Returns a number rounded down to the specified digit.
Arguments Number arg Original number
Number n Position of the digit to be truncated
Exception None
Example of use
print(rounddown(12345.678, -2)); /* 12300となる */
print(rounddown(12345.678));     /* 12345となる */
print(rounddown(12345.678, 2));  /* 12345.67となる */
 
print(rounddown(0.50));  /* 0となる */
print(rounddown(-0.50)); /* -1となる */
Related item round, roundup, roundm methods