Skip to main content
Mathematical operations
Updated over 10 months ago

Basic operators

Operator

Usage

+

Sum a series of values or lists. See also: sum() below.

-

Subtract

*

Multiply

/

Divide

power

^x

or

power(x)

abs

abs(x)

Returns the absolute value of a number.

Examples:

  • abs(-10) returns 10

  • abs(10) returns 10

  • abs(-10m) returns 10m

sum

sum(num1, num2, [...])

Returns the sum of a series of compatible values, either separate or with a list argument.

Examples:

  • sum(1, -3, 2, 6) returns 6

  • sum(list(1, -3, 2, 6)) returns 6

mod

mod() 

Returns the remainder of a division

round

round(dimensionless_number)

Rounds the given (dimensionless) number to the nearest whole number.

Because rounding of dimensioned numbers (e.g. m vs ft) is ambiguous, you must first convert to a dimensionless number by dividing by a dimensionless number using unit().

For example:

round(height / unit("m")) will convert height to a dimensionless number, and round it to the nearest meter

Examples:

  • round(10.2) returns 10

  • round(10.6) returns 11

Rounds a number down to the nearest integer

floor

floor(dimensionless_number)

Rounds the given (dimensionless) number down to an integer.

See round() for a discussion about converting to dimensionless units

Examples:

  • floor(10.2) returns 10

  • floor(10.6) returns 10

ceiling

ceiling(dimensionless_number)

Rounds the given (dimensionless) number up to an integer.

See round() for a discussion about converting to dimensionless units

Examples:

  • ceiling(10.2) returns 11

  • ceiling(10.6) returns 11

sqrt

sqrt(quantity)

Returns the positive square root of a positive number.

Dimensional analysis is supported: the square root of an area is a length.

Examples:

  • sqrt(100) returns 10

  • sqrt(10m*10m) returns 10m

max

max(num1, num2, [...])

Returns the maximum of a series of compatible values, either separate or with a list argument.

Examples:

  • max(1, -3, 2, -2) returns 2

  • max(list(1, -3, 2, -2)) returns 2

min

min(num1, num2, [...])

Returns the minimum of a series of compatible values, either separate or with a list argument.

Examples:

  • min(1, -3, 2, -2) returns -3

  • min(list(1, -3, 2, -2)) returns -3

average

average(num1, num2, [...])

Returns the average of a series of compatible values, either separate or with a list argument.

Examples:

  • average(1, 2, 3) returns 2

  • average(list(1, 2, 3)) returns 2

sin

sin(x)

Calculate sine of a number

cos

cos(x)

Calculate cosine of a number

tan

tan(x)

Calculate tangent of a number

asin

asin(x)

Calculate arcsine of a number

acos

acos(x)

Calculate arccosine of a number

atan

atan(x)

Calculate arctangent of a number

cosh

cosh(x)

Calculate hyperbolic cosine of a number

sinh

sinh(x)

Calculate hyperbolic sine of a number

tanh

tanh(x)

Calculate hyperbolic tangent of a number

acosh

acosh(x)

Calculate inverse hyperbolic cosine of a number

asinh

asinh(x)

calculate inverse hyperbolic sine of a number

atanh

atanh(x)

Calculate inverse hyperbolic tangent of a number


Mathematical Boolean tests

Did this answer your question?