help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



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

trunc

Truncate a floating point value.

Declaration

Source position: mathh.inc line 71

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.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505