(abs number)


Specify that number's distance from 0 (zero), disregarding direction (positive or negative).


This function returns the absolute value of the number. You can use a real number or an integer. This function takes exactly one argument.

Examples

Code Returns
(abs 56) 56
(abs -2.3) 2.30000
(abs -49) 49

NOTES

    • Use this function to convert a negative number to a positive number, or to ensure the number is positive.
    • When you need to make sure a number is negative, first apply the abs function, and then subtract the number from 0.

Tell me about...

(fix number)

(float number)

(minusp number)

LISP Compatibility

Programming Overview of LISP (LISt Processing) Language