The modern and fun way to program.
std.mathstd.math is just an interface to the C++ math library <cmath> plus a
couple of function to generate random numbers.
So, see also the original C++ docs on cplusplus.com).
NANContains the floating-point Not A Number value.
Note that NAN == NAN and std.cast::same(NAN, NAN) return false: use is_nan(x).
INFContains the floating-point Infinity value.
EThe Euler’s number stored in a float.
PIThe PI constant stored in a float.
rand ()Generates and returns a random float between 0 and 1 (1 excluded).
rand_int (min, max)Generates and returns a random integer between min and max (max excluded),
or null if either min or max is not an integer.
deg (r)Converts the angle r (float or integer) expressed in radians to degrees.
Returns the new float, ornull, if r` is an invalid parameter.
rad (d)Converts the angle r (float or integer) expressed in degrees to radians.
Returns the new float, ornull, if r` is an invalid parameter.
frexp (x)Returns a tuple containing the values of significand and exp that make true the following equation:
x = significand * 2exp
hypot (a, b)Returns the length of the hypotenuse given the catheti (i.e. legs) a and b (integers or floats) or null if the parameters are invalid.
Each of the next functions accept as parameter one or more floats (or integers) and return a float, or null if the parameters are invalid. Angles are expressed in radians (both input and output values).
Use deg() and rad() for angle conversions.
cos (x) - compute cosinesin (x) - compute sinetan (x) - compute tangentacos (x) - compute arc cosineasin (x) - compute arc sineatan (x) - compute arc tangentatan2 (x, y) - compute arc tangent of y/xcosh (x) - compute hyperbolic cosinesinh (x) - compute hyperbolic sinetanh (x) - compute hyperbolic tangentacosh (x) - compute area hyperbolic cosineasinh (x) - compute area hyperbolic sineatanh (x) - compute area hyperbolic tangentpow(x, y) - compute xysqrt (x) - compute square root of xcbrt (x) - compute cubic root of xceil (x) - round up xfloor (x) - round down xtrunc (x) - truncate xround (x) - round x to nearest valueround_int (x) - round x to nearest integer value (round_int() returns an integer).exp (x) - compute exexp2 (x) - compute 2xlog (x) - compute natural logarithm of xlog2 (x) - compute base-2 logarithm of xlog10 (x) - compute base-10 logarithm of x