Index

MMO\math

MMO\math · 18 symbols · generated 30 Sep 2026

function

binomialCoefficient

functions.php:189

Compute the binomial coefficient $n! / ($k! * ($n - $k)!)

function binomialCoefficient(int $n, int $k): float
Namespace
MMO\math
$nint
$kint
returnsfloat
Call graph
function

bisection

functions.php:203

Find a root of a continuous function (fn(x) = 0) using the bisection method

function bisection(callable $fn, int|float $a, int|float $b, int|float $epsilon = 0.01): ?float
Namespace
MMO\math
See
https://www.geeksforgeeks.org/dsa/program-for-bisection-method/ WARNING: this only determine ONE solution of all the possible solutions
$fncallablefunction(x):int|float
$aint | floatthe smallest number to try from
$bint | floatthe biggest number to try from
$epsilon = 0.01int | floatthe minimal step
returnsnull | floatif null, could not determine a solution
function

compare

functions.php:76

Compare two values

function compare(mixed $a, mixed $b): int|bool
Namespace
MMO\math
$amixed
$bmixed
returnsint | bool-1 : $a < $b 0 : $a == $b 1 : $a > $b true: $a === $b
Call graph
function

divide

functions.php:138
function divide(MMO\math\interfaces\iNumber|int|float ...$args): MMO\math\interfaces\iNumber|int|float
Namespace
MMO\math
...$argsiNumber | int | float
returnsiNumber | int | float
Call graph
function

factorial

functions.php:176

Do factorial of $n n! = n * (n-1) * (n-2) * ........ * 1

function factorial(int $n): int
Namespace
MMO\math
$nint
returnsint
Call graph
function

isNumber

functions.php:44

Test if a value is a float, int or iNumber

function isNumber(mixed $value): bool
Namespace
MMO\math
$valuemixed
returnsbool
function

max

functions.php:253

Get the maximum value of a list of numbers (iNumber included)

function max(MMO\math\interfaces\iNumber|IteratorAggregate|int|float ...$values): int|float|null
Namespace
MMO\math
...$valuesiNumber | IteratorAggregate | int | float
returnsint | float | null
Call graph
function

min

functions.php:283

Get the minimum value of a list of numbers (iNumber included)

function min(MMO\math\interfaces\iNumber|IteratorAggregate|int|float ...$values): int|float|null
Namespace
MMO\math
...$valuesiNumber | IteratorAggregate | int | float
returnsint | float | null
Call graph
function

minus

functions.php:95
function minus(MMO\math\interfaces\iNumber|int|float ...$args): MMO\math\operations\ArithmeticOperation|int|float
Namespace
MMO\math
Call graph
function

multiply

functions.php:112

Multiply any number (iNumber included) by a factor

function multiply(MMO\math\interfaces\iNumber|int|float ...$args): MMO\math\interfaces\iNumber|int|float
Namespace
MMO\math
...$argsiNumber | int | float
returnsiNumber | int | float
Call graph
function

number

functions.php:56

Convert any value to a number (int|float)

function number(mixed $value, bool $convertNumber = true, bool $ignoreUnits = true): int|float|null
Namespace
MMO\math
$valuemixedif a string, the value is parsed and it returns an int if it can or a float. if iNumber, it returns its value
$convertNumber = trueboolif false and it is a iNumber, null is returned
$ignoreUnits = trueboolif false and the number has units, null is returned
returnsint | float | nullif null, the value cannot be converted to a number
Call graph
function

operatorRegex

functions.php:345

Get a regular expression used to tokenize a math expression (used by parse)

function operatorRegex(): string
Namespace
MMO\math
returnsstring
Call graph

Used by (1)

function

parse

functions.php:372

Tokenize a mathematical expression

function parse( array|string $exp, ?callable $variableFactory = null, array $customOperators = [], array &$vars = [] ): MMO\math\interfaces\iNumber|string
Namespace
MMO\math
$exparray | stringthe mathematical expression
$variableFactory = nullnull | callablefunction($name): ?iNumber. $name is the name of the variable without '$'. If it returns null, a Number is created
$customOperators = []arraythe custom operators in front of parenthesis (like xxx(..,..)) where xxx is the operator
$vars = []array
returnsiNumber | string
Call graph
function

plus

functions.php:84
function plus(MMO\math\interfaces\iNumber|int|float ...$args): MMO\math\operations\ArithmeticOperation|int|float
Namespace
MMO\math
Call graph
function

power

functions.php:160
function power(MMO\math\interfaces\iNumber|int|float $a, float $power): MMO\math\interfaces\iNumber|int|float
Namespace
MMO\math
$aiNumber | int | float
$powerfloat
returnsiNumber | int | float
Call graph
function

roundScale

functions.php:23

Round value to the closest power of ten

function roundScale(int|float $value, int $scale = 0, ?bool $roundUp = null): float
Namespace
MMO\math
$valueint | float
$scale = 0intif < 0, it is a numeral precision. ex: -1 => precise to 0.1, -3 => 0.001 if > 0, it is rounded to the closest value. ex: 2 => rounded to 100. 0 => 1, 6 => 1 000 000
$roundUp = nullnull | bool
returnsfloat
Call graph
function

scale

functions.php:34

Get the power of ten the given value is precise to

function scale(int|float $value): int
Namespace
MMO\math
$valueint | float
returnsint
Call graph
function

size

functions.php:313

Get the size of the given values

function size(MMO\math\interfaces\iNumber|IteratorAggregate|int|float ...$values): int|float
Namespace
MMO\math
...$valuesiNumber | IteratorAggregate | int | float
returnsint | float