The Calculation Wizard’s **Math Functions** allow you to perform mathematical tasks. The following advanced mathematical functions are available on the Form Calculation Widget and when using the Update/Calculate Field condition. You can use this as your reference to build perfect calculation forms.

In the **Form Calculation Widget**:

In the **Update/Calculate Field** Condition:

**Math Functions:**

- abs()
- acos()
- asin()
- atan()
- atan2()
- ceil()
- cos()
- exp()
- floor()
- log()
- max()
- min()
- pow()
- random()
- round()
- sin()
- sqrt()
- tan()

**Math Properties:**

**Other Functions:**

**Tip:** The numbers on the formula below can be replaced with the fields from your form as seen on the actual form when you test it. In other words, the numbers can either be defined on the formula or taken from the user input by adding your form fields.

## Math Functions

### abs()

This returns the absolute value of a number.

**Example:**abs(-100)**Result:**100**Demo:**https://www.jotform.com/form-templates/get-numbers-only-form

### acos()

Calculates the arccosine of a number.

**Example:**acos(0.5)**Result:**1.05**Demo:**https://www.jotform.com/form-templates/get-arccosine-acos-form

### asin()

Calculates the arcsine of a number.

**Example:**asin(0.5)**Result:**0.52**Demo:**https://www.jotform.com/form-templates/get-arcsine-asin-form

### atan()

Calculates the arctangent of a number.

**Example:**atan(1)**Result:**0.7854**Demo:**https://www.jotform.com/form-templates/get-arctangent-atan-form

### atan2()

This function calculates the arctangent of the quotient of its arguments.

**Example:**atan2(4,8)**Result:**0.4636**Demo:**https://www.jotform.com/form-templates/calculate-arctangent2-atan2-form

### ceil()

Round up a number to its nearest integer. If the value is a full number, it will not be rounded.

**Example:**ceil(1.5)**Result:**2**Demo:**https://www.jotform.com/form-templates/round-decimals-upward

### cos()

This returns the cosine of a number.

**Example:**cos(2)**Result:**-0.42**Demo:**https://www.jotform.com/form-templates/get-cosine-cos-form

### exp()

This function returns the value of **Ex**, where **E** is Euler’s number (approximately 2.7183) and **x** is the specified number.

**Example:**exp(1)**Result:**2.7183**Demo:**https://www.jotform.com/form-templates/get-euler-s-number-exp

### floor()

This is the opposite of the ceil() function. This rounds down a number to its nearest integer.

**Example:**floor(1.5)**Result:**1**Demo:**https://www.jotform.com/form-templates/round-decimals-downward-form

### log()

Returns natural logarithm.

**Example:**log(2)**Result:**0.69**Demo:**https://www.jotform.com/form-templates/get-logarithm-log-form

### max()

Output the number with the highest value.

**Example:**max(4,8,2)**Result:**8**Demo:**https://www.jotform.com/form-templates/find-the-highest-value

### min()

Output the number with the lowest value.

**Example:**min(1,2,5)**Result:**1**Demo:**https://www.jotform.com/form-templates/find-the-lowest-value

### pow()

Power returns the value of **x** to the power of **y**. Example **pow(2,3)** means **2*2*2**, which returns **8**.

**Example:**pow(2,3)**Result:**8**Demo:**https://www.jotform.com/form-templates/exponent-power-calculation-form

### random

Returns a random number.

**Example:**random*100000**Resut:**A random number between 0 and 100000**Demo:**https://www.jotform.com/form-templates/generate-random-number-2

### round()

Round a number to the nearest integer.

**Example:**round(2.5)**Result:**3**Demo:**https://www.jotform.com/form-templates/round-off-number

### sin()

Return the sine of a number.

**Example:**sin(3)**Result:**0.14**Demo:**https://www.jotform.com/form-templates/get-sine-sin

### sqrt()

Output the square root of a number.

**Example:**sqrt(25)**Result:**5**Demo:**https://www.jotform.com/form-templates/square-root-calculator-form

### tan()

Calculate the tangent.

**Example:**tan(45)**Result:**1.62**Demo:**https://www.jotform.com/form-templates/get-tangent-tan

## Math Properties

### E

Return the Euler’s number.

**Example:**E * 2**Result:**5.4366**Demo:**https://www.jotform.com/form-templates/euler-s-e-number-calculator-form

### LN2

Outputs the natural logarithm of 2, approximately 0.6931.

**Example:**LN2 * 1**Result:**0.6931**Demo:**https://www.jotform.com/form-templates/logarithm2-ln2-sample-form

### LN10

Outputs the natural logarithm of 10, approximately 2.3026.

**Example:**LN10 * 1**Result:**2.3026**Demo:**https://www.jotform.com/form-templates/logarithm10-ln10-sample-form

### LOG2E

Base-2 logarithm of E, approximately 1.4427.

**Example:**LOG2E * 1**Result:**1.4427**Demo:**https://www.jotform.com/form-templates/base-2-logarithm-of-e-log2e-calculation-form

### LOG10E

Base-10 logarithm of E, approximately 0.4343.

**Example:**LOG10E * 1**Result:**0.4343**Demo:**https://www.jotform.com/form-templates/base-10-logarithm-of-e-log10e-calculation-form

### PI

Return PI. This represents the ratio of the circumference of a circle to its diameter, approximately 3.14159.

**Example:**PI * 1**Result:**3.1416**Demo:**https://www.jotform.com/form-templates/pi-p-calculation-form

### SQRT1_2

Return the square root of 1/2 which is approximately 0.7071.

**Example:**SQRT1_2 * 1**Result:**0.7071**Demo:**https://www.jotform.com/form-templates/get-the-square-root-of-1-2-with-sqrt1-2

### SQRT2

Return the square root of 2, approximately 1.4142.

Example: (√2), which results to 1.414

**Example:**SQRT2 * 1**Result:**1.4142**Demo:**https://www.jotform.com/form-templates/multiply-the-number-with-square-root-of-2-sqrt2

## Other Functions

### avg()

Returns the average value of the list of numeric values.

**Example:** avg(value 1, value 2, value 3)

Here’s an example calculation on my cloned form:

You can find the example **avg()** function here: https://www.jotform.com/70991655420964.

### avgNoZero()

Calculate the average value while excluding empty fields.

**Example:** avgNoZero(value 1, value 2, value 3)

Here’s an example calculation:

You can test this function on my cloned form here: https://www.jotform.com/70991655420964. Look for the **avgNoZero()** heading.

### count()

Returns the number of rows that matches the specified criteria. This is usually used if you want to count the number of selections in a check box field.

**Example:** count(multiple choice field)

Here’s an example calculation:

You can test this on my cloned form here: https://www.jotform.com/70991655420964. Look for the **count()** function heading.

### commaSeparate()

Include comma separators in large numbers.

**Example:** commaSeparate(number value)

Here’s an example case:

You can test this on my cloned form here: https://www.jotform.com/70991655420964. Look for the **commaSeparate()** function heading.

### date()

Returns the sequential serial number that represents a particular date. You’ll need to use the default date picker field if you will be using date-based functions.

**Function usage:** date(date field value)

Here’s an example case:

You can see this in action on my form here: https://www.jotform.com/70991655420964. Find the math function with header **date()** on it.

### dateString()

Converts the DateTime value to a date string.

**Example:** dateString(date field value)

Here’s an example case:

You can see this in action on my cloned form here: https://www.jotform.com/70991655420964. Find the **dateString()** function heading.

### nth()

The function will get the nth biggest field.

**Example** nth(nth biggest, value 1, value 2, value 3)

On my settings and example, the first parameter is the nth biggest rule. In my case, I set it to “1”, which means I’ll get the 1st biggest value in the list of inputs I will set. You can see below I have 3 input boxes, the nth() function will get the 1st biggest value. If you want to get the 2nd highest or biggest value, then set the nth rule to 2.

You can test this on my cloned form here: https://www.jotform.com/70991655420964. Look for the **nth()** function heading.

## Send Comment:

## 6 Comments:

How I can calculate total number of jpg files upload in form and the number that still remains to add 100 files. I want to make a form for printing photos up to 100 files.

How can I calculate the number of hours worked based on time

Hi, I have this big equation that I am trying to put on jotform calculations and it doesn't seem to work. Would you be help out?

In the places of F4, E4 and D4 i would number fields to fill in.

=495/(1.0324-0.19077*log10(F4-E4)+0.15456*log10(D4))-450

min function not working even on the template provided above.

Is it possible to lock this widget so that a form user cannot mess with the formula calculations being done? I can ask them to not reconfigure the math completed in this field, but it would just be easier if they just didn't have the opportunity to do so.

Thanks!

How can I calculate a duration (difference of two different hours)? Thank you.