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



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

abs

Calculate absolute value

Declaration

Source position: line 0

function abs(

  l: LongInt

):LongInt;

function abs(

  l: Int64

):Int64;

function abs(

  d: ValReal

):ValReal;

Description

Abs returns the absolute value of a variable. The result of the function has the same type as its argument, which can be any numerical type.

Errors

None.

See also

Round

  

Round floating point value to nearest integer number.

Example

Program Example1;

{ Program to demonstrate the Abs function. }

Var
  r : real;
  i : integer;

begin
  r:=abs(-1.0);   { r:=1.0 }
  i:=abs(-21);    { i:=21 }
end.

Notes

 No notes exist for this page yet. 





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