The ABS function returns the absolute value of its argument.


To print the absolute value of -25, enter:


IDL prints:



Result = ABS(X)

Return Value

Returns the absolute value of its argument.



The value for which the absolute value is desired. If X is of complex type, ABS returns the magnitude of the complex number:

If X is of complex type, the result is returned as the corresponding floating point type. For all other types, the result has the same type as X. If X is an array, the result has the same structure, with each element containing the absolute value of the corresponding element of X.

ABS applied to any of the unsigned integer types results in the unaltered value of X being returned.


Thread Pool Keywords

This routine is written to make use of IDL’s thread pool, which can increase execution speed on systems with multiple CPUs. The values stored in the !CPU system variable control whether IDL uses the thread pool for a given computation. In addition, you can use the thread pool keywords TPOOL_MAX_ELTS, TPOOL_MIN_ELTS, and TPOOL_NOTHREAD to override the defaults established by !CPU for a single invocation of this routine. See Thread Pool Keywords for details.

Version History