truncate

.truncate x:{Number} decimals:{Int} -> Number

Truncates a floating-point number to a specified number of decimal places.

Return

x truncated to decimals decimal places. If decimals is 0, the number is truncated to an integer, otherwise to a floating-point number

Parameters

x

number to truncate

decimals

maximum number of decimal places to keep. Must be a non-negative number

Throws