ABS function

Purpose:

The ABS function returns the absolute, positive, double precision, floating point, value of a number.

Syntax:

RetVal = ABS(Number)

Return Value:

  • Data type: DOUBLE
    RetVal The absolute, positive, double precision, floating point, value of the argument passed in the Number parameter.

Parameters:

  • Number can be integer, single or double.

Remarks:

While the ABS function can be used within calculations, it is better to use temporary holders for the value of absolute function that use floating point values since on very rare occasions it needs to be normalized on return. The storing of an unnormalized floating point variable forces normalization.

Example:

DIM RetVal AS DOUBLE

RetVal = ABS(-123.45)

PRINT RetVal

Result:

123.45

BCX Console Sample Programs using the ABS function.


IABS function

Purpose:

The IABS function returns the absolute, positive, integer precision, value of a number.

Syntax:

RetVal = IABS(Number)

Return Value:

  • Data type: INTEGER
    RetVal The absolute, positive, integer precision, value of the argument passed in the Number parameter.

Parameters:

  • Number can be integer, single or double.

Remarks:

While the IABS function can be used within calculations, it is better to use temporary holders for the value of absolute function that use floating point values since on very rare occasions it needs to be normalized on return. The storing of an unnormalized floating point variable forces normalization.

Example:

DIM RetVal AS INTEGER

RetVal = IABS(-123.45)

PRINT RetVal

Result:

123