[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'System' (#rtl)

Trunc

Truncate a floating point value.

Declaration

Source position: mathh.inc line 117

function Trunc(

  d: ValReal

):Int64;

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

  

Return fractional part of floating point value.

Int

  

Calculate integer part of floating point value.

Round

  

Round floating point value to nearest integer number.

Example

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.

Documentation generated on: Jun 23 2021