abs()

The system function MathLib.abs returns the absolute value of a number.

  MathLib.abs(numericField mathLibNumber in)
  returns (result mathLibTypeDependentResult)
result
Any numeric or HEX item, as described in Mathematical (system words). The absolute value of numericItem is converted to the format of result and returned in result.
numericField
Any numeric item or HEX item, as described in Mathematical (system words).

MathLib.abs works on every target system. In relation to Java™ programs, EGL uses one of the abs() methods in the Java StrictMath class so that the runtime behavior is the same for every Java Virtual Machine.

Example

  myItem = -5;
  result = MathLib.abs(myItem);  // result = 5

Related reference
EGL library MathLib

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.