Skip to content

Abs ​

Abs returns the absolute value of the number specified by the e parameter.

An absolute number is where the sign is not recognised, and is stripped off.

Declaration: Function Abs(e : Extended) : Extended;

Several examples follow.

pascal
procedure OnMapEvent(var Value:Variant);
var
  aTan ; extended;
begin
 //Result is 123
  aTan := Abs(123);
  LogInfo(FloatToStr(aTan));

 //Result is 123
  LogInfo(FloatToStr(Abs(-123)));

 //Result is 0.456789
  LogInfo(FloatToStr(Abs(-0.4567890)));

 //Result is 367.3723938034
  LogInfo(FloatToStr(Abs(-367.3723938034)));

 //Result is 578.97
  LogInfo(FloatToStr(Abs(578.97)));

end;