math
Documentation for math.
Library containing more advanced mathematical operations.
Types
std::math::AccumulateOperation
Options to use with the std::math::accumulate function.
enum AccumulateOperation : {
Add,
Max,
Min,
Modulo,
Multiply
};Functions
std::math::min
Compares the values a and b with each other and returns the smaller of the two
a: First valueb: Second valuereturn:aifais smaller thanb, otherwiseb
fn min( a, b);std::math::max
Compares the values a and b with each other and returns the bigger of the two
a: First valueb: Second valuereturn:aifais bigger thanb, otherwiseb
fn max( a, b);std::math::clamp
Clamps the value of x between min and max.
x: Valuemin: Minimum valuemax: Maximum valuereturn:minifxis smaller thanmin,maxifxis bigger thanmax,xotherwise
fn clamp( x, min, max);std::math::abs
Returns the absolute value of x.
x: Valuereturn:xifxis positive,-xotherwise
fn abs( x);std::math::sign
Returns the sign of x.
x: Valuereturn:1ifxis positive,-1ifxis negative,0ifxis zero
fn sign( x);std::math::copy_sign
Copies the sign of y to x.
x: Valuey: Valuereturn:xifyis positive,-xifyis negative
fn copy_sign( x, y);std::math::factorial
Calculates the factorial of x.
x: Valuereturn: Factorial ofx
fn factorial( x);std::math::comb
Calculates the binomial coefficient of n and k.
n: Valuek: Valuereturn: Binomial coefficient ofnandk
fn comb( n, k);std::math::perm
Calculates the permutation of n and k.
n: Valuek: Valuereturn: Permutation ofnandk
fn perm( n, k);std::math::floor
Floors the value of value.
value: Valuereturn:valuefloored
fn floor( value);std::math::ceil
Ceils the value of value.
value: Valuereturn:valueceiled
fn ceil( value);std::math::round
Rounds the value of value.
value: Valuereturn:valuerounded
fn round( value);std::math::trunc
Truncates the value of value.
value: Valuereturn:valuetruncated
fn trunc( value);std::math::log10
Calculates the logarithm of value with base 10.
value: Valuereturn: Logarithm ofvaluewith base 10
fn log10( value);std::math::log2
Calculates the logarithm of value with base 2.
value: Valuereturn: Logarithm ofvaluewith base 2
fn log2( value);std::math::ln
Calculates the natural logarithm of value.
value: Valuereturn: Logarithm ofvaluewith basee
fn ln( value);std::math::fmod
Calculates the floating point modulus (remainder) of the division of x by y.
x: Numeratory: Denominatorreturn: Floating point modulus (remainder) of the division ofxbyy
fn fmod( x, y);std::math::pow
Calculates the value of base raised to the power of exp.
base: Baseexp: Exponentreturn:baseraised to the power ofexp
fn pow( base, exp);std::math::exp
Calculates the value of the natural number e raised to the power of value.
value: Exponentreturn:eraised to the power ofvalue
fn exp( value);std::math::sqrt
Calculates the square root of value.
value: Valuereturn: Square root ofvalue
fn sqrt( value);std::math::cbrt
Calculates the cubic root of value.
value: Valuereturn: Cubic root ofvalue
fn cbrt( value);std::math::sin
Calculates the sine of value.
value: Angle value in radiansreturn: Sine ofvalue
fn sin( value);std::math::cos
Calculates the cosine of value.
value: Angle value in radiansreturn: Cosine ofvalue
fn cos( value);std::math::tan
Calculates the tangent of value.
value: Angle value in radiansreturn: Tangent ofvalue
fn tan( value);std::math::asin
Calculates the arc sine of value.
value: Angle value in radiansreturn: Arc sine ofvalue
fn asin( value);std::math::acos
Calculates the arc cosine of value.
value: Valuereturn: Arc cosine ofvaluein radians
fn acos( value);std::math::atan
Calculates the arc tangent of value.
value: Valuereturn: Arc tangent ofvaluein radians between-pi/2andpi/2
fn atan( value);std::math::atan2
Calculates the arc tangent of value.
y: Value representing the proportion of the y-coordinatex: Value representing the proportion of the x-coordinate.return: Arc tangent ofvaluein radians between-piandpi
fn atan2( y, x);std::math::sinh
Calculates the hyperbolic sine of value.
value: Angle value in radiansreturn: Hyperbolic sine ofvalue
fn sinh( value);std::math::cosh
Calculates the hyperbolic cosine of value.
value: Angle value in radiansreturn: Hyperbolic cosine ofvalue
fn cosh( value);std::math::tanh
Calculates the hyperbolic tangent of value.
value: Angle value in radiansreturn: Hyperbolic tangent ofvalue
fn tanh( value);std::math::asinh
Calculates the arc hyperbolic sine of value.
value: Valuereturn: Arc hyperbolic sine ofvalue
fn asinh( value);std::math::acosh
Calculates the arc hyperbolic cosine of value.
value: Valuereturn: Arc hyperbolic cosine ofvalue
fn acosh( value);std::math::atanh
Calculates the arc hyperbolic tangent of value.
value: Valuereturn: Arc hyperbolic tangent ofvalue
fn atanh( value);std::math::accumulate
Calculates the sum of all values in the specified memory range.
start: Start addressend: End addressvalueSize: Size of each value in bytes[section]: Section to use[operation]: Operation to use. Defaults to addition[endian]: Endianness to use. Defaults to nativereturn: Sum of all values in the specified memory range
fn accumulate( start, end, valueSize, std::mem::Section section, std::math::AccumulateOperation operation, std::mem::Endian endian);