March 2000
Intermediate to advanced
576 pages
18h 13m
English
Trunc Function
function Trunc(X: Floating-point type): Int64;The Trunc function truncates a floating-point
value by discarding the fractional part (round towards zero). Unlike
Int, Trunc returns an integer
result. Trunc is not a real
function.
The Trunc function temporarily sets the
floating-point control word, then truncates the number, and restores
the control word.
If X is an integer, the compiler eliminates the
call to Trunc and simply returns
X.
If X is a Variant, Delphi
automatically converts it to a floating-point number and truncates
it.
The compiler does not accept an Int64 argument,
but there is no reason to call Trunc for
Int64.
If X is infinity or NaN, Trunc
reports runtime error 6 (EInvalidOp).
| Int Function, Round Function |
Read now
Unlock full access