Math Operators

There are various Math operators support on PIM's Dashboard

  • Addition Operator (sum)

  • Multiply Operator (mul)

  • Subtraction Operator(diff)

  • Divide Operator(divide)

  • Modulo Operator ( modulo )

  • Ceil Operator ( ceil )

  • Floor Operator ( floor )

  • Absolute Operator ( abs )

  • clamp Operator ( clamp )

  • numberFormat Operator

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

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

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

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

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

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

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

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

8 . Absolute Operator

Returns the absolute value of a number

1

Create a page state

for this example we created a page state variable var of type number

2

Enter an initial value to your state

we entered -10 as our intial value for our page state

Argument

it will take a page state arguement

abs(var)
//var = -10
//it will output 10,the absolute value of -10

9 . Clamp Operator

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

Argument

 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

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

Last updated