Function reference · Math
trunc
Truncates a numeric expression toward zero.
Numeric inputs discard the fractional part without changing the sign of the integer portion. Symbolic inputs remain as trunc(x).
Examples
These examples use Nerdamer Notation.
Discard a positive fractional part.
trunc(3.7) // → 3
Truncate a negative number toward zero.
trunc(-2.7) // → -2
Interfaces
The same operation is available through the interfaces below.
Nerdamer Notation
Use this form inside input passed to nerdamer(...).
trunc(arg1)
nerdamer.trunc
Call the operation through the default nerdamer import.
nerdamer.trunc(x: ExpressionInput): Expression
Parameters
| Name | Type | Description |
|---|---|---|
x | ExpressionInput | The expression to truncate. |
Returns
Expression — The integer portion of `x`, or symbolic `trunc(x)`.
