This information is for Vicon Shogun 1.7. For up-to-date help, see the latest Shogun documentation.

Vicon Shogun banner

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 command.

Functional area

Math

Command syntax

Syntax

abs number

Arguments

NameTypeRequiredComments
numberintegeryesIf 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

Examples

// 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