Math Library
1.10.1¶
#include <std/math.pat>
Functions¶
std::math::min(auto a, auto b) -> auto
1.10.1¶
Returns the smaller number between “a” and “b”
Parameter |
Description |
---|---|
|
First value |
|
Second value |
|
|
std::math::max(auto a, auto b) -> auto
1.10.1¶
Returns the larger number between “a” and “b”
Parameter |
Description |
---|---|
|
First value |
|
Second value |
|
|
std::math::clamp(auto x, auto min, auto max) -> auto
1.10.1¶
Clamps the value “x” between “min” and “max”
Parameter |
Description |
---|---|
|
Value |
|
Minimal value allowed |
|
Maximal value allowed |
|
|
std::math::abs(auto x) -> auto
1.10.1¶
Calculates the absolute value of “x”
Parameter |
Description |
---|---|
|
Value |
|
|
std::math::sign(auto x) -> auto
1.10.1¶
Gets the sign of a value
Parameter |
Description |
---|---|
|
Value |
|
|
std::math::copy_sign(auto x, auto y) -> auto
1.10.1¶
Applies the sign of “y” and applies it to “x”
Parameter |
Description |
---|---|
|
Value |
|
Sign value |
|
|
std::math::factorial(auto x) -> auto
1.10.1¶
Calculates the factorial of “x”
Parameter |
Description |
---|---|
|
Value |
|
Factorial of |
std::math::comb(u128 n, u128 k) -> u128
1.10.1¶
Calculates the binomial coefficient of “k” and “”n”. (n-choose-k)
Parameter |
Description |
---|---|
|
n value |
|
k value |
|
n-choose-k |
std::math::perm(u128 n, u128 k) -> u128
1.10.1¶
Calculates the number of ways to choose “k” items from “n” items without repetition and with order
Parameter |
Description |
---|---|
|
n value |
|
k value |
|
Result |
std::math::floor(auto value) -> auto
1.14.0¶
Floors the value
Parameter |
Description |
---|---|
|
Value |
|
Value rounded down to the next integer |
std::math::ceil(auto value) -> auto
1.14.0¶
Ceils the value
Parameter |
Description |
---|---|
|
Value |
|
Value rounded up to the next integer |
std::math::round(auto value) -> auto
1.14.0¶
Rounds the value
Parameter |
Description |
---|---|
|
Value |
|
Value rounded towards the next integer rounding up at 0.5 |
std::math::trunc(auto value) -> auto
1.14.0¶
Truncates the fractional part of the value
Parameter |
Description |
---|---|
|
Value |
|
Value with the fractional part removed |
std::math::log10(auto value) -> auto
1.14.0¶
Calculates the log with base 10 of the value
Parameter |
Description |
---|---|
|
Value |
|
|
std::math::log2(auto value) -> auto
1.14.0¶
Calculates the log with base 2 of the value
Parameter |
Description |
---|---|
|
Value |
|
|
std::math::ln(auto value) -> auto
1.14.0¶
Calculates the log with base e of the value
Parameter |
Description |
---|---|
|
Value |
|
|
std::math::fmod(auto x, auto y) -> auto
1.14.0¶
Calculates the floating-point remainder of the division of x / y
Parameter |
Description |
---|---|
|
Value 1 |
|
Value 2 |
|
Remainder of |
std::math::pow(auto base, auto exp) -> auto
1.14.0¶
Calculates the floating-point remainder of the division of x / y
Parameter |
Description |
---|---|
|
Base |
|
Exponent |
|
|
std::math::sqrt(auto value) -> auto
1.14.0¶
Calculates the square root of the value
Parameter |
Description |
---|---|
|
Value |
|
Square root of value |
std::math::cbrt(auto value) -> auto
1.14.0¶
Calculates the cube root of the value
Parameter |
Description |
---|---|
|
Value |
|
Cube root of value |
std::math::sin(auto value) -> auto
1.14.0¶
Calculates the sine of the value
Parameter |
Description |
---|---|
|
Value |
|
Sine of value |
std::math::cos(auto value) -> auto
1.14.0¶
Calculates the cosine of the value
Parameter |
Description |
---|---|
|
Value |
|
Cosine of value |
std::math::tan(auto value) -> auto
1.14.0¶
Calculates the tangent of the value
Parameter |
Description |
---|---|
|
Value |
|
Tangent of value |
std::math::asin(auto value) -> auto
1.14.0¶
Calculates the arc-sine of the value
Parameter |
Description |
---|---|
|
Value |
|
Arc-sine of value |
std::math::acos(auto value) -> auto
1.14.0¶
Calculates the arc-cosine of the value
Parameter |
Description |
---|---|
|
Value |
|
Arc-cosine of value |
std::math::atan(auto value) -> auto
1.14.0¶
Calculates the arc-tangent of the value
Parameter |
Description |
---|---|
|
Value |
|
Arc-tangent of value |
std::math::sinh(auto value) -> auto
1.14.0¶
Calculates the hyperbolic sine of the value
Parameter |
Description |
---|---|
|
Value |
|
Sine of value |
std::math::cosh(auto value) -> auto
1.14.0¶
Calculates the hyperbolic cosine of the value
Parameter |
Description |
---|---|
|
Value |
|
Cosine of value |
std::math::tanh(auto value) -> auto
1.14.0¶
Calculates the hyperbolic tangent of the value
Parameter |
Description |
---|---|
|
Value |
|
Tangent of value |
std::math::asinh(auto value) -> auto
1.14.0¶
Calculates the hyperbolic arc-sine of the value
Parameter |
Description |
---|---|
|
Value |
|
Arc-sine of value |
std::math::acosh(auto value) -> auto
1.14.0¶
Calculates the hyperbolic arc-cosine of the value
Parameter |
Description |
---|---|
|
Value |
|
Arc-cosine of value |
std::math::atanh(auto value) -> auto
1.14.0¶
Calculates the hyperbolic arc-tangent of the value
Parameter |
Description |
---|---|
|
Value |
|
Arc-tangent of value |