Menu
FloatTypedArray
abstractclass
abstract class FloatTypedArray<T> extends TypedArray
The floating-point arrays: every element is a float.
Assigning accepts a float, an int, a bool (as 1.0 or 0.0) and a
numeric string; anything else (null, arrays, objects, non-numeric
strings) throws TypeError. NaN and infinities are stored as they
are. Reading always gives a float. See {@see Float32Array} and
{@see Float64Array}.
Type parameters
T- = float
Methods
offsetGet() | Returns the element at $offset: $a[$offset]. |
offsetSet() | Stores $value at $offset: $a[$offset] = $value; $a[] = $value appends. |
sum() | The sum of the elements (summed in index order). |
min() | Returns the smallest element. |
max() | Returns the largest element. |
offsetGet()#source
function offsetGet(mixed $offset): float
Returns the element at $offset: $a[$offset].
Parameters
$offsetmixed- the index
Returns
T — the element
Throws
- \OutOfBoundsException
- when the position is outside
0..count-1 - \TypeError
- when
$offsetis of the wrong kind
offsetSet()#source
function offsetSet(mixed $offset, mixed $value): void
Stores $value at $offset: $a[$offset] = $value; $a[] = $value appends.
Parameters
$offsetmixed- the index, or null to append
$valuemixed- the element
Throws
- \OutOfBoundsException
- when the position is outside
0..count-1 - \TypeError
- when
$valueor$offsetis of the wrong kind
sum()#source
function sum(): float
The sum of the elements (summed in index order).
Returns
float — the sum; 0.0 for an empty array
min()#source
function min(): float
Returns the smallest element.
Returns
float — the minimum
Throws
- \ValueError
- when the array is empty
max()#source
function max(): float
Returns the largest element.
Returns
float — the maximum
Throws
- \ValueError
- when the array is empty