XLISP abs

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# abs

Type: | - | function (subr)
Source: | - | xlisp/xlmath.c

## Syntax

(abs number)
  number - an integer or floating point expression
  returns - the absolute value of the number

## Description

The 'abs' function computes the absolute value of a number and returns the result. A 'bad argument type' error is signalled if the argument is not a numebr.

## Examples

    (abs 1)       => 1
    (abs -99)     => 99
    (abs -99.9)   => 99.9
    (abs -32768)  => 32768
    (abs "123")   => error: bad argument type

See also:

- Contents → Arithmetic Functions

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference