Flow PHP

RunningSum

FinalYes

Neumaier-compensated float sum; exact (decimal) addition goes through Calculator.

Methods

__construct()  : mixed
add()  : void
addAll()  : void
add() over every value, the compensated loop inlined: one call per batch, not per value.
emptyPartial()  : array{int: int, float: null, compensation: float}
fromPartial()  : self
merge()  : void
partial()  : array{int: null|int, float: null|float, compensation: float}
partialType()  : StructureType
value()  : float|int
valueOf()  : float|int

Methods

add()

public add(float|int|numeric-string $value, bool $exact) : void
Parameters
$value : float|int|numeric-string
$exact : bool

addAll()

add() over every value, the compensated loop inlined: one call per batch, not per value.

public addAll(array<string|int, float|int|numeric-string> $values, bool $exact) : void
Parameters
$values : array<string|int, float|int|numeric-string>
$exact : bool

emptyPartial()

public static emptyPartial() : array{int: int, float: null, compensation: float}
Return values
array{int: int, float: null, compensation: float} —

the partial of a sum nothing was added to

merge()

public merge(self $other, bool $exact) : void
Parameters
$other : self
$exact : bool

partial()

public partial() : array{int: null|int, float: null|float, compensation: float}
Return values
array{int: null|int, float: null|float, compensation: float} —

exactly one of int and float is set

partialType()

public static partialType() : StructureType
Return values
StructureType

value()

public value() : float|int
Return values
float|int

valueOf()

public static valueOf(array{int: null|int, float: null|float, compensation: float} $partial) : float|int
Parameters
$partial : array{int: null|int, float: null|float, compensation: float}

the shape of partial()

Return values
float|int
On this page

Search results