Abs Function

Returns a value of the same type that is passed to it specifying the absolute value of a number.

Syntax

Abs([num])

The optional num argument is any valid numeric expression. If this argument is omitted, is a non-initialized variable, or Null, the function returns 0.

Remarks

The absolute value of a number is its unsigned magnitude. For example, Abs(-1) and Abs(1) both return 1.

Example

Dim MyNumber
MyNumber = Abs(36.6)   ' Returns 36.6.
MyNumber = Abs(-36.6)  ' Returns 36.6.

 

See Also

Sgn Function