25 define(
'NEGATIVE_INF', -INF );
73 public function count() {
81 public function push( $x ) {
84 $this->min = min( $this->min, $x );
85 $this->max = max( $this->max, $x );
91 $this->m1 += $delta_n;
92 $this->m2 += $delta * $delta_n * $n1;
118 if ( $this->
n === 0 ) {
121 } elseif ( $this->
n === 1 ) {
124 return $this->m2 / ( $this->
n - 1.0 );
152 if ( $other->n === 0 ) {
157 if ( $this->
n === 0 ) {
158 $this->
n = $other->n;
159 $this->m1 = $other->m1;
160 $this->m2 = $other->m2;
161 $this->min = $other->min;
162 $this->max = $other->max;
166 $n = $this->
n + $other->n;
168 $delta2 = $delta * $delta;
170 $this->m1 = ( ( $this->
n *
$this->m1 ) + ( $other->n * $other->m1 ) ) /
$n;
171 $this->m2 = $this->m2 + $other->m2 + ( $delta2 * $this->
n * $other->n /
$n );
172 $this->min = min( $this->min, $other->min );
173 $this->max = max( $this->max, $other->max );