next up previous contents index
Next: Truncate Up: Functions and Procedures Previous: Swap

Trunc

   

Declaration:

Function Trunc (X : real) : Longint;

Description:

Trunc returns the integer part of X, which is always smaller than (or equal to) X.

Errors:

None.

See also:

Frac, Int, Trunc

Example
Program Example54;

{ 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.



Michael Van Canneyt
Thu Sep 10 14:02:43 CEST 1998