Skip to content

Numbers and rounding

The square root of x, with its units halved.

sqrt(16 m^2) = 4 m

The real nth root of x; an odd root of a negative number is negative.

nthroot(-27, 3) = -3

The absolute value of x, or the magnitude of a complex number. Also written |x|.

abs(-3 kN) = 3 kN

The real part of z.

Re(3 + 4i) = 3

The imaginary part of z.

Im(3 + 4i) = 4

The angle of z in the complex plane, between −π and π.

arg(1i) = 1.571

The complex conjugate of z, element by element in an array.

conj(3 + 4i) = 3 - 4i

−1, 0 or 1, as x is negative, zero or positive.

sign(-2.5) = -1

z divided by its magnitude, or 0 when z is 0.

signum(3 + 4i) = 0.6 + 0.8i

e to the power x.

exp(1) = 2.718

The natural logarithm of x.

ln(e^2) = 2

The logarithm of x to base 10, or to base b.

log(1000) = 3
log(8, 2) = 3

The largest integer not above x.

floor(-2.5) = -3

The smallest integer not below x.

ceil(2.1) = 3

x rounded to n decimal places, or to an integer.

round(3.14159, 2) = 3.14

The integer part of x, towards zero.

trunc(-2.7) = -2

The largest multiple of y not above x; x and y may have units, the same.

Floor(2.7 m, 0.5 m) = 2.5 m

The smallest multiple of y not below x.

Ceil(2.7 m, 0.5 m) = 3 m

x rounded to the nearest multiple of y.

Round(17 mm, 5 mm) = 15 mm

The multiple of y nearest x towards zero.

Trunc(-2.7, 0.5) = -2.5

The remainder of x divided by y, with the sign of x.

mod(17, 5) = 2

The largest of the numbers given, arrays included element by element.

max(3 m, 450 mm, [1 m; 5 m]) = 5 m

The smallest of the numbers given.

min(3, 1, [4; 2]) = 1

The gamma function: Γ(n) is (n − 1)! for a whole number n.

Γ(5) = 24

The gamma function, as Γ(x).

gamma(0.5) = 1.772

The natural logarithm of the gamma function, for large x.

lnΓ(100) = 359.134

The error function.

erf(1) = 0.843

The complementary error function, 1 − erf(x).

erfc(1) = 0.157