Numeric Functions

AMPS includes the following functions for working with numbers.

Function
Parameters
Description

ABS

number

Returns the absolute value of a number.

For example, the following filter will be TRUE when the difference between /a and /b is greater than 5, regardless of whether /a or /b is larger.

 ABS(/a - /b) > 5 

GREATEST

list of numbers to compare

Returns the largest of the provided numbers, or NaN if no argument is a number.

 GREATEST(/requestedQty, /availableQty, /reserveQty) 

LEAST

list of numbers to compare

Returns the smallest of the provided numbers, or NaN if no argument is a number.

 LEAST(/requestedQty, /availableQty, /reserveQty) 

CEILING

number to round

Returns the value rounded upward to the next greatest integer. Returns an integer unchanged.

 CEILING(/estimatedDelta) 

FLOOR

number to round

Returns the value rounded downward to the next lower integer. Returns an integer unchanged.

 FLOOR(/estimatedReturn) 

EXP

exponent to use

Returns e raised to the power of the provided exponent.

 EXP(3.14) 

LN

number

Returns the natural logarithm of the provided number.

 LN(/time) 

LOG2

number

Returns the base-2 logarithm of the provided number.

 LOG2(/recordSize) 

LOG10

number

Returns the base-10 logarithm of the provided number.

 LOG10(/displayData) 

POWER

base, exponent

Returns the value of base raised to the power of exponent.

 POWER(/number, 3) 

SQRT

number

Returns the square root of the provided number.

 SQRT(2304) 

COS

number

Returns the cosine of the provided number.

 COS(/x) 

ACOS

number

Returns the arcosine of the provided number.

 ACOS(/x) 

SIN

number

Returns the sine of the provided number.

 SIN(/x) 

SINH

number

Returns the hyperbolic sine of the provided number.

 SINH(/x) 

ASIN

number

Returns the arcsine of the provided number.

 ASIN(/x) 

COSH

number

Returns the hyperbolic cosine of the provided number.

 COSH(/x) 

COT

number

Returns the cotangent of the provided number.

 COT(/x) 

ATAN

number

Returns the arctangent of the provided number.

 ATAN(/x) 

ATAN2

number, number

Returns the arctangent of the provided numbers.

 ATAN2(/y,/x) 

TAN

number

Returns the tangent of the provided number.

 TAN(/x) 

TANH

number

Returns the hyperbolic tangent of the provided number.

 TANH(/x) 

MD5

string

Returns the MD5 checksum of the provided string.

 MD5(/data) 

RADIANS

number

Returns the provided number converted from degrees to radians.

 RADIANS(/deg) 

DEGREES

number

Returns the provided number converted from radians to degrees.

 DEGREES(/rad) 

SIGN

number

Returns the sign of the provided number.

If the number is less than 0, returns -1. If the number is greater than 0, returns 1. Otherwise, the number is 0 and the function returns 0.

 SIGN(/result) 

ROUND

number, [number of decimal places]

Returns a number rounded to the specified number of decimal places.

The number of decimal places is optional. When not provided, the number defaults to 0.

The number of decimal places can be positive or negative. When the number is positive, the number specifies the number of digits to the right of the decimal place to round at. When the number is negative, the number specifies the number of digits to the left of the decimal place to round at.

For example, you could use the following expression in a view to limit the precision of the /price field of the source topic to 2 decimal places.

 ROUND(/price, 2) AS /price 

WIDTH_BUCKET

expression, min, max, bucket count

The bucket count argument specifies the number of buckets to create over the range defined by min and max. min is inclusive, while max is not.

The value from expression is assigned to a bucket, and the function returns a corresponding bucket number. When expression falls outside the range of buckets, the function returns either 0 or max + 1, depending on whether expression is lower than min or greater than or equal to max.

 WIDTH_BUCKET(/percentage, 0, 100, 10) AS /displayBar 

Last updated

Copyright 2013-2024 60East Technologies, Inc.