# Maths functions

FastStats supports the following mathematical functions:

## Log

Log base 10

Expression

```apteco
Log([Value])
```

Examples:

- `Log(100)` = 2
- `Log(1000)` = 3

## Abs

Absolute Valu

Expression

```apteco
Abs([Value])
```

Examples:

- `Abs(123.45)` = 123.45
- `Abs(-123.45)` = 123.45

## Sqrt

Square Root

Expression

```apteco
Sqrt([Value])
```

Examples:

- `Sqrt(4)` = 2
- `Sqrt(64)` = 8

## Ceil

Round up

Expression

```apteco
Ceil([Value])
```

Examples:

- `Ceil(123.1)` = 124
- `Ceil(123.9)` = 124

## Floor

Round down

Expression

```apteco
Floor([Value])
```

Examples:

- `Floor(123.1)` = 123
- `Floor(123.9)` = 123

## Ln

Natural log

Expression

```apteco
Ln([Value])
```

## Exp

Exponential

Expression

```apteco
Exp([Value])
```

## RoundUp

Round Up to specified precision.

Expression

```apteco
RoundUp([Value],[Precision])
```

For example, `RoundUp(123,10)` rounds up to the next 10, i.e. 130.

## RoundDown

Round Down to specified precision.

Expression

```apteco
RoundDown([Value],[Precision])
```

For example, `RoundDown(123,10)` rounds down to the next 10, i.e. 120.

## Round

Round off to specified precision.

Expression

```apteco
Round([value])
```

Expression

```apteco
Round([Value],[Precision])
```

For example, `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.

Expression

```apteco
Rand([Value])
```

## Power

Power

Expression

```apteco
Power(x,y)
```

For example, 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.

Expression

```apteco
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.

For example, `DecToHex(666)` will return the hexadecimal result of 29A.

## HexToDec

Allows you to convert hexadecimal strings into decimal numbers.

For example, `HexToDec(“29A”)` will return the decimal number 666

## Trigonometry functions

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:

- [https://en.wikipedia.org/wiki/Trigonometric\_functions](<https://en.wikipedia.org/wiki/Trigonometric_functions>)
- [https://en.wikipedia.org/wiki/Inverse\_trigonometric\_functions](<https://en.wikipedia.org/wiki/Inverse_trigonometric_functions>)
- [https://en.wikipedia.org/wiki/Hyperbolic\_function](<https://en.wikipedia.org/wiki/Hyperbolic_function>)
