Skip to content

Commit bd87f30

Browse files
author
Peter Mead
committed
Don't use PHP's fmod
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.
1 parent dfdcb5b commit bd87f30

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/JsonSchema/Constraints/NumberConstraint.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function check(&$element, $schema = null, JsonPointer $path = null, $i =
7171
private function fmod($number1, $number2)
7272
{
7373
$number1 = abs($number1);
74-
$modulus = fmod($number1, $number2);
74+
$modulus = ($number1 - round($number1 / $number2) * $number2);
7575
$precision = abs(0.0000000001);
7676
$diff = (float) ($modulus - $number2);
7777

0 commit comments

Comments
 (0)