Core.Terms.AbsoluteValue

From emotive
Jump to navigation Jump to search

Classification

Name AbsoluteValue
Short Description Returns the value of the operand without regard to its sign
Class Term
Extension OTX Core library
Group Operations
Exceptions -
Checker Rules -
Standard Compliant Yes

OTL Syntax

NumericValue = |NumericTerm|;

Description

AbsoluteValue is a NumericTerm which returns the value of the operand without regard to its sign.

Return Value

The Term returns the value, see table below.

Icons Note.png In OTX, Terms are categorized according to its return data type!
Data Type Description
Integer, Float The value of the operand without regard to its sign. If the operand is of type float, the return value is float. Otherwise, the return value of the type is integer.

Properties

Name Data Type Class Default Cardinality Description
Numeral Integer, Float Term - [1] The numeric term whose absolute value will be returned.

OTL Examples

/// Local Declarations

Integer MyValue1 = -123456;
Float MyValue2 = -123.456;
Integer Result1;
Float Result2;

/// Flow

// Below expression should return 123456
Result1 = |MyValue1|;
// Below expression should return 123.456
Result2 = |MyValue2|;
// Below expression should return 135801.6
Result2 = |MyValue1 * 1.1|;

See also

Add
Subtract
Multiply
Divide
Modulo
Quantities Absolute Value
Round
Negate