# Math Operators

#### There are various Math operators support on PIM's Dashboard

* <mark style="color:blue;">**Addition Operator**</mark> <kbd><mark style="color:blue;">(sum)<mark style="color:blue;"></kbd>
* <mark style="color:blue;">**Multiply Operator**</mark> <kbd><mark style="color:blue;">(mul)<mark style="color:blue;"></kbd>
* <mark style="color:blue;">**Subtraction Operator**</mark><kbd><mark style="color:blue;">(diff)<mark style="color:blue;"></kbd>
* <mark style="color:blue;">**Divide Operator**</mark><kbd><mark style="color:blue;">(divide)<mark style="color:blue;"></kbd>
* <mark style="color:blue;">**Modulo Operator**</mark> <kbd><mark style="color:blue;">( modulo )<mark style="color:blue;"></kbd>
* <mark style="color:blue;">**Ceil Operator**</mark> <kbd><mark style="color:blue;">( ceil )<mark style="color:blue;"></kbd>
* <mark style="color:blue;">**Floor Operator**</mark> <kbd><mark style="color:blue;">( floor )<mark style="color:blue;"></kbd>
* <mark style="color:blue;">**Absolute Operator**</mark> <kbd><mark style="color:blue;">( abs )<mark style="color:blue;"></kbd>
* <mark style="color:blue;">**clamp Operator**</mark> <kbd><mark style="color:blue;">( clamp )<mark style="color:blue;"></kbd>
* <mark style="color:blue;">**numberFormat Operator**</mark>

#### 1. Addition Operator (sum)

when you want to sum couple of numbers than you can use sum operator

#### Arguments

This Operator can take upto 255 arguments

#### Example

```javascript
sum(1,2,4); //this will return 7 as output
```

#### 2. Multiply Operator (mul)

when you want to multiply couple of numbers than you can use multiply operator

#### Arguments

This Operator can take upto 255 arguments

#### Example

```javascript
mul(1,2,4); //this will return 8 as output
```

#### 3. Subtraction Operator (diff)

used to perform subtraction operation

#### `Arguments`

This operator will take two arguments and both arguments are required

#### Example

```javascript
diff(5,2); 
// this will return 3 as output
// Explanation: 5-2 = 3
```

#### 4. Divide Operator (divide)

used to perform divide mathematical operation

#### Arguments

This operator will take two arguments and both arguments are required

#### Example

```javascript
divide(4,2); 
// this will return 2 as output
// Explanation: 4/2 = 2
```

#### 5 . Modulo operator

Returns the remainder of division of first number by second

#### Arguments

This operator will take two number arguments

#### Example

```javascript
modulo(5,2)
//it will return 1 as 5 divided by 2 leaves
// a remainder of 1
```

#### 6 . Ceil operator

Rounds a number up to the nearest integer

#### Arguments

It will take one number argument

#### Example

```javascript
ceil(4.5)
//it will output 5 as it is nearest up integer
```

#### 7. Floor Operator

Rounds a number down to the nearest integer

#### Arguements

it will take one number arguement

#### Exampe

```javascript
floor(4.5)
//it will output 4 as it is the nearest down integer
```

#### 8 . Absolute Operator

Returns the absolute value of a number

{% stepper %}
{% step %}
**Create a page state**

for this example we created a page state variable var of type number
{% endstep %}

{% step %}
**Enter an initial value to your state**

we entered -10 as our intial value for our page state
{% endstep %}
{% endstepper %}

#### Argument

it will take a page state arguement

<pre class="language-javascript"><code class="lang-javascript">abs(var)
<strong>//var = -10
</strong>//it will output 10,the absolute value of -10
</code></pre>

#### 9 . Clamp Operator

Restricts a value to be within the specified range \[min, max]

Argument

```javascript
 clamp(10,6,8)
//it will return 8 as 10 is out of bounds
```

#### 10 . number format

Formats a number using the specified format. Defaults to '##,##,###

#### Arguments

requires a number and a format

#### Example

```javascript
numberFormat(9883928872, '##,##,##')
//it will output 98,83,92,88,72
```
