Formulas: Numerical functions

Revision as of 06:05, 2 January 2018 by Dominique Bauer (talk | contribs) (Numerical functions)

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 3.3. Up-to-date documentation for the latest stable version of Moodle is probably available here: Formulas: Numerical functions.

Numerical functions

The numerical functions available in the Formulas question type are listed in the table below:

Function Definition
No argument
pi() Value of π (=3.14159...)
One argument
abs(x) Absolute value
acos(x) Arccosine (in radians)
acos(x) returns a numeric value between 0 and π radians for x between -1 and 1, otherwise NAN
acos(-2) = NAN
acos(-1) = 3.1415926535898
acos(0) = 1.5707963267949
acos(0.5) = 1.0471975511966
acos(1) = 0
acos(2) = NAN
acosh(x) Inverse hyperbolic cosine
asin(x) Arcsine (in radians)
asinh(x) Inverse hyperbolic sine
atan(x) Arctangent (in radians)
atanh(x) Inverse hyperbolic tangent
ceil(x) Ceiling function
ceil(x) = ⌈x⌉ is the smallest integer greater or equal to x
cos(x) Cosine of a value given in radians
cosh() Hyperbolic cosine
deg2rad() Converts a degree value to a radian value
exp(x) Exponential function
exp(x) = ex where (= 2.71828...) is the base of the natural logarithm
fact(x) Factorial of x. Gives the numerical value up to fact(170) and INF thereafter.
floor(x) Floor function
floor(x) = ⌊x⌋ is the largest integer less than or equal to x
rad2deg(x) Converts a radian value to a degree value
round(x) Rounds a value to the nearest integer
sin(x) Sine of a value given in radians
sinh(x) Hyperbolic sine
sqrt(x) Square root
tan(x) Tangent of a value given in radians
tanh(x) Hyperbolic tangent
Two arguments
pow(x,y) The base x taken to the exponent y
pow(x,y) = xy
Several arguments
min(x1,x2,...) Returns the lowest value
max(x1,x2,...) Returns the highest value

Note that the functions used in the variable assignments is (almost) a superset of the functions used in the algebraic formulas.

Back to top of page