Math
*
Multiplication of numbers.
Type:
('a, 'a) -> 'a where 'a is a number type
Arguments:
(unlabeled)(of typeanything that is a number type)(unlabeled)(of typeanything that is a number type)
+
Addition of numbers.
Type:
('a, 'a) -> 'a where 'a is a number type
Arguments:
(unlabeled)(of typeanything that is a number type)(unlabeled)(of typeanything that is a number type)
-
Subtraction of numbers.
Type:
('a, 'a) -> 'a where 'a is a number type
Arguments:
(unlabeled)(of typeanything that is a number type)(unlabeled)(of typeanything that is a number type)
/
Division of numbers.
Type:
('a, 'a) -> 'a where 'a is a number type
Arguments:
(unlabeled)(of typeanything that is a number type)(unlabeled)(of typeanything that is a number type)
abs
Absolute value.
Type:
('a) -> 'a where 'a is a number type
Arguments:
(unlabeled)(of typeanything that is a number type)
acos
Arc cosine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between 0.0 and pi.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
asin
Arc sine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between -pi/2 and pi/2.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
atan
Arc tangent. Result is in radians and is between -pi/2 and pi/2.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
bool_of_float
Convert a float to a bool.
Type:
(float) -> bool
Arguments:
(unlabeled)(of typefloat)
bool_of_int
Convert an int to a bool.
Type:
(int) -> bool
Arguments:
(unlabeled)(of typeint)
ceil
Round above to an integer value. ceil(x) returns the least integer whose value is greater than or equal to x. The result is returned as a float.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
cos
Cosine. Argument is in radians.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
cosh
Hyperbolic cosine. Argument is in radians.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
exp
Exponential.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
float
Convert a number to a float.
Type:
('a) -> float where 'a is a number type
Arguments:
(unlabeled)(of typeanything that is a number type)
float.is_infinite
Return true if the floating point number is infinite.
Type:
(float) -> bool
Arguments:
(unlabeled)(of typefloat)
float.is_nan
Return true if the floating point number is NaN.
Type:
(float) -> bool
Arguments:
(unlabeled)(of typefloat)
float.truncate
Round a float to a given number of decimal digits. Mode can be "ceil" (round up), "floor" (round down), or "default" (round to nearest).
Type:
(?digits : int, ?mode : string, float) -> float
Arguments:
digits(of typeint, which defaults to0): Number of decimal digits to keep.mode(of typestring, which defaults to"default"): Rounding mode:"ceil","floor", or"default".(unlabeled)(of typefloat)
float_of_int
Convert an int to a float.
Type:
(int) -> float
Arguments:
(unlabeled)(of typeint)
floor
Round below to an integer value. floor(x) returns the greatest integer whose value is less than or equal to x. The result is returned as a float.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
infinity
Float representation of infinity.
Type:
float
int
Convert a number to an integer.
Type:
('a, ?raise : bool) -> int where 'a is a number type
Arguments:
(unlabeled)(of typeanything that is a number type)raise(of typebool, which defaults tofalse): Raiseerror.invalidif number isNaNor+/-infinity.
int_of_float
Convert a float to a int.
Type:
(float) -> int
Arguments:
(unlabeled)(of typefloat)
ln
Natural logarithm.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
log10
Base 10 logarithm.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
lsl
Logical shift left.
Type:
(int, int) -> int
Arguments:
(unlabeled)(of typeint): Number to shift.(unlabeled)(of typeint): Number of bits to shift.
lsr
Logical shift right.
Type:
(int, int) -> int
Arguments:
(unlabeled)(of typeint): Number to shift.(unlabeled)(of typeint): Number of bits to shift.
max_int
Maximal representable integer.
Type:
int
min_int
Minimal representable integer.
Type:
int
mod
Remainder of division of numbers.
Type:
('a, 'a) -> 'a where 'a is a number type
Arguments:
(unlabeled)(of typeanything that is a number type)(unlabeled)(of typeanything that is a number type)
nan
A special floating-point value denoting the result of an undefined operation such as 0.0 /. 0.0. Stands for 'not a number'. Any floating-point operation with nan as argument returns nan as result. As for floating-point comparisons, ==, <, <=, > and >= return false and != returns true if one or both of their arguments is nan.
Type:
float
pow
Exponentiation of numbers.
Type:
('a, 'a) -> 'a where 'a is a number type
Arguments:
(unlabeled)(of typeanything that is a number type)(unlabeled)(of typeanything that is a number type)
random.float
Generate a random value between min (included) and max (excluded).
Type:
(?min : float, ?max : float) -> float
Arguments:
min(of typefloat, which defaults to0.0)max(of typefloat, which defaults to1.0)
random.int
Generate a random value between min (included) and max (excluded).
Type:
(?min : int, ?max : int) -> int
Arguments:
min(of typeint, which defaults to-536870911)max(of typeint, which defaults to536870912)
round
Rounds x to the nearest integer with ties (fractional values of 0.5) rounded away from zero, regardless of the current rounding direction. If x is an integer, +0., -0., nan, or infinite, x itself is returned.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
sign
Return 1. if the argument is positive and -1. otherwise.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
sin
Sine. Argument is in radians.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
sinh
Hyperbolic sine. Argument is in radians.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
sqrt
Square root.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
tan
Tangent. Argument is in radians.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
tanh
Hyperbolic tangent. Argument is in radians.
Type:
(float) -> float
Arguments:
(unlabeled)(of typefloat)
~-
Returns the opposite of its argument.
Type:
('a) -> 'a where 'a is a number type
Arguments:
(unlabeled)(of typeanything that is a number type)