Trunc

Declaration:
Function Trunc (X : Real) : Longint;
Description:
Trunc returns the integer part of X, which is always smaller than (or equal to) X in absolute value.
Errors:
None.
See also:
Frac (503), Int (523), Round (561)

Listing: refex/ex70.pp


Program Example70;

{ Program to demonstrate the Trunc function. }

begin
  Writeln (Trunc(123.456));  { Prints 123  }
  Writeln (Trunc(-123.456)); { Prints -123 }
  Writeln (Trunc(12.3456));  { Prints 12   }
  Writeln (Trunc(-12.3456)); { Prints -12  }
end.