Skip to content

Math Functions

Mathematical Functions

A set of mathematical and trigonometric functions.

FunctionAction
MathAbsReturns absolute value (modulus) of the specified numeric value
MathArccosReturns the arc cosine of x in radians
MathArcsinReturns the arc sine of x in radians
MathArctanReturns the arc tangent of x in radians
MathCeilReturns integer numeric value closest from above
MathCosReturns the cosine of a number
MathExpReturns exponent of a number
MathFloorReturns integer numeric value closest from below
MathLogReturns natural logarithm
MathLog10Returns the logarithm of a number by base 10
MathMaxReturns the maximal value of the two numeric values
MathMinReturns the minimal value of the two numeric values
MathModReturns the real remainder after the division of two numbers
MathPowRaises the base to the specified power
MathRandReturns a pseudorandom value within the range of 0 to 32767
MathRoundRounds of a value to the nearest integer
MathSinReturns the sine of a number
MathSqrtReturns a square root
MathSrandSets the starting point for generating a series of pseudorandom integers
MathTanReturns the tangent of a number
MathIsValidNumberChecks the correctness of a real number

What’s new in MQL5

Added hyperbolic trigonometric functions and the MathSwap function for changing the byte order in ushort, uint and ulong integer types. The need for such a transformation often arises when working with the Network functions.

The Mathematics section contains the ready-made libraries for working with random distributions, fuzzy logic and neural networks. It also contains functions for solving differential equations, clustering, statistical analysis and optimization tasks.

Last updated on