---
title: "abs"
canonical: "https://help.vicon.com/space/ShogunPost121/1253738387/abs"
format: markdown
---
# Description

The abs command returns the absolute value of an integer. This return value is always greater than or equal to zero. If a variable of type float is passed in as an argument, the abs command performs a truncating integer conversion, then returns the absolute value of that integer. If the input data is floating point and you want the output type to be floating point, use the [fabs](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737000) command.

## Functional area

Math

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `abs number` |

### Arguments

| **Name** | **Type** | **Required** | **Comments** |
| --- | --- | --- | --- |
| `number` | integer | yes | If num is of type float, a truncation is used to convert to int. |

### Flags

None

## Return value

integer

Returns an integer that is greater than or equal to 0 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// the following script shows that positive 1 is returned for 
// both calls to abs
int $integer_variable = 1.0;
float $float_variable = 1.9;
int $abs_of_float_variable = `abs $float_variable`;
int $abs_of_integer_variable = `abs $integer_variable`;
print("i is " + string($abs_of_integer_variable));
print("f is " + string($abs_of_float_variable));
```

# Additional information

## Related commands

[fabs](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737000)