fix param casting for hhvm compatibility

This commit is contained in:
Arkadiusz Kondas 2016-05-02 23:06:17 +02:00
parent 3fd5abf566
commit 56114d99ce
5 changed files with 6 additions and 6 deletions

View File

@ -49,7 +49,7 @@ class Point implements ArrayAccess
$distance += $difference * $difference;
}
return $precise ? sqrt($distance) : $distance;
return $precise ? sqrt((float)$distance) : $distance;
}
/**

View File

@ -30,6 +30,6 @@ class Euclidean implements Distance
$distance += pow($a[$i] - $b[$i], 2);
}
return sqrt($distance);
return sqrt((float)$distance);
}
}

View File

@ -147,7 +147,7 @@ class Matrix
for ($j = 0; $j < $this->columns; ++$j) {
$subMatrix = $this->crossOut(0, $j);
$minor = $this->matrix[0][$j] * $subMatrix->getDeterminant();
$determinant += fmod($j, 2) == 0 ? $minor : -$minor;
$determinant += fmod((float)$j, 2.0) == 0 ? $minor : -$minor;
}
}
@ -236,7 +236,7 @@ class Matrix
for ($i = 0; $i < $this->rows; ++$i) {
for ($j = 0; $j < $this->columns; ++$j) {
$minor = $this->crossOut($i, $j)->getDeterminant();
$newMatrix[$i][$j] = fmod($i + $j, 2) == 0 ? $minor : -$minor;
$newMatrix[$i][$j] = fmod((float)($i + $j), 2.0) == 0 ? $minor : -$minor;
}
}

View File

@ -38,7 +38,7 @@ class Correlation
$b2 = $b2 + pow($b, 2);
}
$corr = $axb / sqrt($a2 * $b2);
$corr = $axb / sqrt((float)($a2 * $b2));
return $corr;
}

View File

@ -39,6 +39,6 @@ class StandardDeviation
--$n;
}
return sqrt($carry / $n);
return sqrt((float)($carry / $n));
}
}