Abs() Numeric Function

Purpose

Returns the absolute value of a numeric expression.

Syntax

Abs(x)

x:aexp

Description

The number argument can be any valid numeric expression. The return value has the same type as the argument x.

Example

Print Abs(-210)   // Prints 210

Print Abs(5 - 10) // Prints 5

Print Abs(-0.3)   // Prints 0.3

Remarks

The returned value from Abs() depends on the sign of the x argument:

for x < 0 returns -x,

for x = 0 returns 0 and

for x > 0 returns x.

See Also

Sgn

{Created by Sjouke Hamstra; Last updated: 23/09/2014 by James Gaite}