# Formula Math Functions

## Overview

Tap supports a number of common math functions. The key thing with the math functions, as with any function, is they are written inside parenthesis with the operator first.

Any value within a math function can be replaced with other math functions, as in: `(+ (- 41 1) 2)`. Which is more commonly noted as `(41 - 1 + 2)`. Tap uses the former notation to make it easier to combine more advanced formula functions.

## Reference

### +

`(+ x y)`

Note: use sum to add more than two numbers

### -

`(- x y)`

Subtract y from x.

### *

`(* x y)`

Multiply two numbers.

### /

`(/ x y)`

Divide x by y.

### %

`(% x y)`

x mod y

### min

`(min x [y ...])`

Takes an arbitrary number of parameters and returns the least number.

### max

`(max x [y ...])`

Takes an arbitrary number of parameters and returns the greatest number.

### sum

`(sum x [y ...])`

### round

`(round x)`

Round decimal to nearest integer value.

### floor

`(floor x)`

Returns the greatest integer less or equal than the input x

### ceil

`(ceil x)`

Returns the least integer greater than or equal the input x

### pow

`(pow base exponent)`

Computes the power of a number base to the exponent

### cos

`(cos x)`

Computes cosine of x

### sin

`(sin x)`

Computes sine of x

### tan

`(tan x)`

Computes tangent of x

### random

`(random x y)`

Retrieve a random integer between x and y (inclusive)