[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Trunc Truncates a Real Value to an Integer
Trunc(X : Real) : Integer;
Returns the integral portion of X--i.e., the portion of X to the left
of the decimal point. If X is an integer, Int(X) = X. Note that X :=
Int(X) + Frac(X).
Returns the integral portion of X--i.e., the portion of X to the left
of the decimal point. X must be in the range -32768..32767; otherwise,
a runtime error 146 ($92) occurs. Note that Trunc(X) = Int(X), with
two important exceptions: Trunc(X) returns an integer value, while
Int(X) returns a real value, and Trunc(X) has a range restriction on
X, while Int(X) doesn't.
Limits: If X is outside the range -32768..32767, runtime error
146 ($92) occurs (regardless of range checking).
-------------------------------- Example ---------------------------------
I := Trunc( 42.4); { I = 42 }
I := Trunc(-42.4); { I = -42 }
See Also:
Round
Int
Frac
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson