math
Note: parts of this file are platform-conditional
(#if).
Functions: abs, clamp, sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, exp, exp2, log, log2, log10, pow, sqrt, cbrt, hypot, ceil, floor, trunc, round, fmod
abs
T abs<T>(T value)Returns the absolute value.
clamp
T clamp<T>(T value, T min, T max)Constrains the value to the given range.
sin
extern double sin(double x);Returns the sine of x.
float sin(float x)Returns the sine of x.
cos
extern double cos(double x);Returns the cosine of x.
float cos(float x)Returns the cosine of x.
tan
extern double tan(double x);Returns the tangent of x.
float tan(float x)Returns the tangent of x.
asin
extern double asin(double x);Returns the arc sine of x.
float asin(float x)Returns the arc sine of x.
acos
extern double acos(double x);Returns the arc cosine of x.
float acos(float x)Returns the arc cosine of x.
atan
extern double atan(double x);Returns the arc tangent of x.
float atan(float x)Returns the arc tangent of x.
atan2
extern double atan2(double y, double x);Returns the arc tangent of y/x.
float atan2(float y, float x)Returns the arc tangent of y/x.
sinh
extern double sinh(double x);Returns the hyperbolic sine of x.
float sinh(float x)Returns the hyperbolic sine of x.
cosh
extern double cosh(double x);Returns the hyperbolic cosine of x.
float cosh(float x)Returns the hyperbolic cosine of x.
tanh
extern double tanh(double x);Returns the hyperbolic tangent of x.
float tanh(float x)Returns the hyperbolic tangent of x.
exp
extern double exp(double x);Returns e raised to the power x.
float exp(float x)Returns e raised to the power x.
exp2
extern double exp2(double x);Returns 2 raised to the power x.
float exp2(float x)Returns 2 raised to the power x.
log
extern double log(double x);Returns the natural logarithm of x.
float log(float x)Returns the natural logarithm of x.
log2
extern double log2(double x);Returns the base-2 logarithm of x.
float log2(float x)Returns the base-2 logarithm of x.
log10
extern double log10(double x);Returns the base-10 logarithm of x.
float log10(float x)Returns the base-10 logarithm of x.
pow
extern double pow(double x, double y);Returns x raised to the power y.
float pow(float x, float y)Returns x raised to the power y.
sqrt
extern double sqrt(double x);Returns the square root of x.
float sqrt(float x)Returns the square root of x.
cbrt
extern double cbrt(double x);Returns the cube root of x.
float cbrt(float x)Returns the cube root of x.
hypot
extern double hypot(double x, double y);Returns the square root of the sum of the squares of x and y.
float hypot(float x, float y)Returns the square root of the sum of the squares of x and y.
ceil
extern double ceil(double x);Rounds x up to an integer.
float ceil(float x)Rounds x up to an integer.
floor
extern double floor(double x);Rounds x down to an integer.
float floor(float x)Rounds x down to an integer.
trunc
extern double trunc(double x);Rounds x toward zero to an integer.
float trunc(float x)Rounds x toward zero to an integer.
round
extern double round(double x);Rounds x to the nearest integer.
float round(float x)Rounds x to the nearest integer.
fmod
extern double fmod(double x, double y);Returns the remainder of x/y.
float fmod(float x, float y)Returns the remainder of x/y.
pi
const float pi = 3.14159265358979323846;Ratio of a circle's circumference to its diameter.
e
const float e = 2.71828182845904523536;Base of the natural logarithm.