Expand/Shrink

trunc

Definition: atom a2 = trunc(atom a1)
Description: return the integer portion of a number.
Comments: The result is always truncated towards zero, whereas floor truncates towards minus infinity.

This function may be applied to an atom or sq_trunc() to all elements of a sequence. The rules for sequence operations apply.
Example:
?trunc(1.4)         --  1
?floor(1.4)         --  1
?trunc(-1.4)        -- -1
?floor(-1.4)        -- -2
Implementation: See builtins\pmaths.e (an autoinclude) for details of the actual implementation.
See Also: floor