Skip to content

Commit

Permalink
Don't use PHP's fmod
Browse files Browse the repository at this point in the history
PHP's fmod has some quirks.  The private fmod function wraps it to iron out some of those quirks but ultimately it's better to just not use it.
  • Loading branch information
Peter Mead committed Nov 28, 2017
1 parent dfdcb5b commit bd87f30
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/JsonSchema/Constraints/NumberConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function check(&$element, $schema = null, JsonPointer $path = null, $i =
private function fmod($number1, $number2)
{
$number1 = abs($number1);
$modulus = fmod($number1, $number2);
$modulus = ($number1 - round($number1 / $number2) * $number2);
$precision = abs(0.0000000001);
$diff = (float) ($modulus - $number2);

Expand Down

0 comments on commit bd87f30

Please sign in to comment.