abs

operator

Library: Floating point number support (OMFLOAT)
Import : omfloat.xmd
Library: Binary coded decimal numbers (OMBCD)
Import : ombcd.xmd

Returns: the absolute value of a specified number


Declaration
export overloaded external float function
   abs value float x

export overloaded external bcd function
   abs value bcd x


Purpose

Use abs to get the absolute value of a floating point number or BCD number.

To get the absolute value of a BCD number, you must import the ombcd.xmd file in your program. To get the absolute value of a floating point number, import the omfloat.xmd file.

BCD Example:

The following program will output "$34.98":

  import "ombcd.xmd" unprefixed
  process
      local bcd price
      set price to -34.98
      output "<$,NNZ.ZZ>" % abs price

Other Library Functions