# truncate

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

Content copied to clipboard

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

- Likely named

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

#### Throws

IllegalArgumentException

if decimals is negative

#### Chaining

This function is designed to be chained with other function calls:

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

Content copied to clipboard