# ABS

> ABS function in StackQL: the absolute value of a numeric argument.

Source: https://stackql.io/language-spec/functions/math/abs

Returns the absolute value of the numeric argument.  

See also:  
[[` SELECT `]](/language-spec/select) 

* * * 

## Syntax

```sql
SELECT ABS(numeric_expression) FROM <multipartIdentifier>;
```

> `abs(X)` returns `NULL` if `X` is `NULL`. `abs(X)` returns `0.0` if `X` is a string or blob that cannot be converted to a numeric value. If `X` is the integer -9223372036854775808 then `abs(X)` throws an integer overflow error since there is no equivalent positive 64-bit two complement value.

## Arguments

__*numeric_expression*__  
An expression of the exact numeric or approximate numeric data type category.

## Return Value(s)

Returns a positive numeric value.

* * *

## Examples

### Return the absolute value of a number

```sql
SELECT name, abs(strftime('%s', creationTimestamp)-strftime('%s','now')) as abs_value
FROM google.compute.instances 
WHERE project = 'stackql-demo' 
AND zone = 'australia-southeast1-a';
```

For more information, see [https://www.sqlite.org/lang_mathfunc.html](https://www.sqlite.org/lang_mathfunc.html)
