Factorial
in package
uses
ArrayEnabled
Table of Contents
Properties
Methods
- fact() : array<string|int, mixed>|float|int|string
- FACT.
- factDouble() : array<string|int, mixed>|float|int|string
- FACTDOUBLE.
- multinomial() : float|int|string
- MULTINOMIAL.
- evaluateArrayArguments() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
- evaluateArrayArgumentsIgnore() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
- evaluateArrayArgumentsSubset() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
- evaluateArrayArgumentsSubsetFrom() : array<string|int, mixed>
- Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
- evaluateSingleArgumentArray() : array<string|int, mixed>
- Handles array argument processing when the function accepts a single argument that can be an array argument.
- initialiseHelper() : void
- testFalse() : bool
Properties
$arrayArgumentHelper
private
static ArrayArgumentHelper
$arrayArgumentHelper
$initializationNeeded
private
static bool
$initializationNeeded
= true
Methods
fact()
FACT.
public
static fact(array<string|int, mixed>|float $factVal) : array<string|int, mixed>|float|int|string
Returns the factorial of a number. The factorial of a number is equal to 123*...* number.
Excel Function: FACT(factVal)
Parameters
- $factVal : array<string|int, mixed>|float
-
Factorial Value, or can be an array of numbers
Return values
array<string|int, mixed>|float|int|string —Factorial, or a string containing an error If an array of numbers is passed as the argument, then the returned result will also be an array with the same dimensions
factDouble()
FACTDOUBLE.
public
static factDouble(array<string|int, mixed>|float $factVal) : array<string|int, mixed>|float|int|string
Returns the double factorial of a number.
Excel Function: FACTDOUBLE(factVal)
Parameters
- $factVal : array<string|int, mixed>|float
-
Factorial Value, or can be an array of numbers
Return values
array<string|int, mixed>|float|int|string —Double Factorial, or a string containing an error If an array of numbers is passed as the argument, then the returned result will also be an array with the same dimensions
multinomial()
MULTINOMIAL.
public
static multinomial(array<string|int, mixed> ...$args) : float|int|string
Returns the ratio of the factorial of a sum of values to the product of factorials.
Parameters
- $args : array<string|int, mixed>
-
An array of mixed values for the Data Series
Return values
float|int|string —The result, or a string containing an error
evaluateArrayArguments()
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
protected
static evaluateArrayArguments(callable $method, mixed ...$arguments) : array<string|int, mixed>
Example use for: ROUND() or DATE().
Parameters
- $method : callable
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsIgnore()
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
protected
static evaluateArrayArgumentsIgnore(callable $method, int $ignore, mixed ...$arguments) : array<string|int, mixed>
Example use for: HLOOKUP() and VLOOKUP(), where argument 1 is a matrix that needs to be treated as a database rather than as an array argument.
Parameters
- $method : callable
- $ignore : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsSubset()
Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
protected
static evaluateArrayArgumentsSubset(callable $method, int $limit, mixed ...$arguments) : array<string|int, mixed>
Example use for: NETWORKDAYS() or CONCATENATE(), where the last argument is a matrix (or a series of values) that need to be treated as a such rather than as an array arguments.
Parameters
- $method : callable
- $limit : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateArrayArgumentsSubsetFrom()
Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
protected
static evaluateArrayArgumentsSubsetFrom(callable $method, int $start, mixed ...$arguments) : array<string|int, mixed>
Example use for: Z.TEST() or INDEX(), where the first argument 1 is a matrix that needs to be treated as a dataset rather than as an array argument.
Parameters
- $method : callable
- $start : int
- $arguments : mixed
Return values
array<string|int, mixed>evaluateSingleArgumentArray()
Handles array argument processing when the function accepts a single argument that can be an array argument.
protected
static evaluateSingleArgumentArray(callable $method, array<string|int, mixed> $values) : array<string|int, mixed>
Example use for: DAYOFMONTH() or FACT().
Parameters
- $method : callable
- $values : array<string|int, mixed>
Return values
array<string|int, mixed>initialiseHelper()
private
static initialiseHelper(array<string|int, mixed>|false $arguments) : void
Parameters
- $arguments : array<string|int, mixed>|false
-
Can be changed to array for Php8.1+
testFalse()
private
static testFalse(mixed $value) : bool
Parameters
- $value : mixed