Basic operators
Operator | Usage |
| Sum a series of values or lists. See also: |
| Subtract |
| Multiply |
| Divide |
power
^x
or
power(x)
abs
abs(x)
Returns the absolute value of a number.
Examples:
abs(-10)returns10abs(10)returns10abs(-10m)returns10m
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)returns6sum(list(1, -3, 2, 6))returns6
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)returns10round(10.6)returns11
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)returns10floor(10.6)returns10
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)returns11ceiling(10.6)returns11
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)returns10sqrt(10m*10m)returns10m
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)returns2max(list(1, -3, 2, -2))returns2
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-3min(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)returns2average(list(1, 2, 3))returns2
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
