Comment on page
math
Library containing more advanced mathematical operations.
Options to use with the
std::math::accumulate
function.enum AccumulateOperation : u8 {
Add,
Max,
Min,
Modulo,
Multiply
};
Compares the values
a
and b
with each other and returns the smaller of the twoa
: First valueb
: Second valuereturn
:a
ifa
is smaller thanb
, otherwiseb
fn min(auto a, auto b);
Compares the values
a
and b
with each other and returns the bigger of the twoa
: First valueb
: Second valuereturn
:a
ifa
is bigger thanb
, otherwiseb
fn max(auto a, auto b);
Clamps the value of
x
between min
and max
.x
: Valuemin
: Minimum valuemax
: Maximum valuereturn
:min
ifx
is smaller thanmin
,max
ifx
is bigger thanmax
,x
otherwise
fn clamp(auto x, auto min, auto max);
Returns the absolute value of
x
.x
: Valuereturn
:x
ifx
is positive,-x
otherwise
fn abs(auto x);
Returns the sign of
x
.x
: Valuereturn
:1
ifx
is positive,-1
ifx
is negative,0
ifx
is zero
fn sign(auto x);
Copies the sign of
y
to x
.x
: Valuey
: Valuereturn
:x
ify
is positive,-x
ify
is negative
fn copy_sign(auto x, auto y);
Calculates the factorial of
x
.x
: Valuereturn
: Factorial ofx
fn factorial(u128 x);
Calculates the binomial coefficient of
n
and k
.n
: Valuek
: Valuereturn
: Binomial coefficient ofn
andk
fn comb(u128 n, u128 k);
Calculates the permutation of
n
and k
.n
: Valuek
: Valuereturn
: Permutation ofn
andk
fn perm(u128 n, u128 k);
Floors the value of
value
.value
: Valuereturn
:value
floored
fn floor(auto value);
Ceils the value of
value
.value
: Valuereturn
:value
ceiled
fn ceil(auto value);
Rounds the value of
value
.value
: Valuereturn
:value
rounded
fn round(auto value);
Truncates the value of
value
.value
: Valuereturn
:value
truncated
fn trunc(auto value);
Calculates the logarithm of
value
with base 10.value
: Valuereturn
: Logarithm ofvalue
with base 10
fn log10(auto value);
Calculates the logarithm of
value
with base 2.value
: Valuereturn
: Logarithm ofvalue
with base 2
fn log2(auto value);
Calculates the natural logarithm of
value
.value
: Valuereturn
: Logarithm ofvalue
with basee
fn ln(auto value);
Calculates the floating point modulus of
value
.value
: Valuereturn
: Floating point modulus ofvalue
fn fmod(auto value);
Calculates the value of
base
raised to the power of exp
.base
: Baseexp
: Exponentreturn
:base
raised to the power ofexp
fn pow(auto base, auto exp);
Calculates the value of the natural number
e
raised to the power of value
.value
: Exponentreturn
:e
raised to the power ofvalue
fn exp(auto value);
Calculates the square root of
value
.value
: Valuereturn
: Square root ofvalue
fn sqrt(auto value);
Calculates the cubic root of
value
.value
: Valuereturn
: Cubic root ofvalue
fn cbrt(auto value);
Calculates the sine of
value
.value
: Angle value in radiansreturn
: Sine ofvalue
fn sin(auto value);
Calculates the cosine of
value
.value
: Angle value in radiansreturn
: Cosine ofvalue
fn cos(auto value);
Calculates the tangent of
value
.value
: Angle value in radiansreturn
: Tangent ofvalue
fn tan(auto value);
Calculates the arc sine of
value
.value
: Angle value in radiansreturn
: Arc sine ofvalue
fn asin(auto value);
Calculates the arc cosine of
value
.value
: Valuereturn
: Arc cosine ofvalue
in radians
fn acos(auto value);
Calculates the arc tangent of
value
.value
: Valuereturn
: Arc tangent ofvalue
in radians between-pi/2
andpi/2
fn atan(auto value);
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 ofvalue
in radians between-pi
andpi
fn atan2(auto y, auto x);
Calculates the hyperbolic sine of
value
.value
: Angle value in radiansreturn
: Hyperbolic sine ofvalue
fn sinh(auto value);
Calculates the hyperbolic cosine of
value
.value
: Angle value in radiansreturn
: Hyperbolic cosine ofvalue
fn cosh(auto value);
Calculates the hyperbolic tangent of
value
.value
: Angle value in radiansreturn
: Hyperbolic tangent ofvalue
fn tanh(auto value);
Calculates the arc hyperbolic sine of
value
.value
: Valuereturn
: Arc hyperbolic sine ofvalue
fn asinh(auto value);
Calculates the arc hyperbolic cosine of
value
.value
: Valuereturn
: Arc hyperbolic cosine ofvalue
fn acosh(auto value);
Calculates the arc hyperbolic tangent of
value
.value
: Valuereturn
: Arc hyperbolic tangent ofvalue
fn atanh(auto value);
Calculates the sum of all values in the specified memory range.
start
: Start addressend
: End addressvalueSize
: Size of each value in bytessection
: Section to useoperation
: Operation to useendian
: Endianness to usereturn
: Sum of all values in the specified memory range
fn accumulate(u128 start, u128 end, u128 valueSize, std::mem::Section section, std::math::AccumulateOperation operation, std::mem::Endian endian);
Last modified 1mo ago