Expression: Maths Functions

FastStats supports the following mathematical functions:

Log

 

log base 10

 

Log([Value])

 

Log(100) = 2

Log(1000) = 3

 

Abs

Absolute Value

 

Abs([Value])

 

Abs(123.45) = 123.45

Abs(-123.45) = 123.45

 

Sqrt

 

Square Root

 

Sqrt([Value])

 

Sqrt(4) = 2

Sqrt(64) = 8

 

Ceil

 

Round up

 

Ceil([Value])

 

Ceil(123.1) = 124

Ceil(123.9) = 124

 

Floor

Round down

 

Floor([Value])

 

Floor(123.1) = 123

Floor(123.9) = 123

 

Ln

Natural log

 

Ln([Value])

 

Exp

 

Exponential

 

Exp([Value])

 

RoundUp

Round Up to specified precision

 

RoundUp([Value],[Precision])

 

e.g. RoundUp(123,10) rounds up to the next 10, i.e. 130

 

RoundDown

Round Down to specified precision

 

RoundDown([Value],[Precision])

 

e.g. RoundDown(123,10) rounds down to the next 10, i.e. 120

 

Round

Round off to specified precision

 

Round([value])

Round([Value],[Precision])

 

e.g. Round(x) rounds x off to the nearest integer.  Round(123,10) rounds off to the nearest 10, i.e. 120

 

Rand

Returns a random number between 0 and its argument, or 0 and 1 if no argument is given

 

Rand([Value])

 

Power

Power

 

Power(x,y)

 

e.g. Calculates x to the power of y.  Power(x,y)  is equivalent to x ^ y.  Power(3,2) = 3 ^ 2 = 9

 

SequenceNumber

Returns a new number for each record processed

 

SequenceNumber(1)

 

When used on a Data Grid the first row will show 1, the second row will show 2 and so on. Useful when having to create a unique row number to otherwise unidentified data

DecToHex

Allows you to convert decimal numbers into hexadecimal strings.

 

e.g. DecToHex(666) will return the hexadecimal result of 29A

HexToDec

Allows you to convert hexadecimal strings into decimal numbers.

 

e.g. HexToDec(“29A”) will return the decimal number 666

 

A group of 9 functions cover basic, inverse and hyperbolic trigonometry:

  • Basic - Sin(n), Cos(n), Tan(n)

  • Inverse - ASin(n), ACos(n), ATan(n)

  • Hyperbolic - Sinh(n), Cosh(n), Tanh(n)

 

More details on these functions can be found on the Wikipedia website:

 

See also - Expressions Overview