Skip to content

Commit

Permalink
Use intdiv()
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Oct 11, 2023
1 parent f85d78c commit b51ec8a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Internal/Calculator/NativeCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,8 @@ public function divQR(string $a, string $b) : array
if (is_int($nb)) {
// the only division that may overflow is PHP_INT_MIN / -1,
// which cannot happen here as we've already handled a divisor of -1 above.
$q = intdiv($na, $nb);
$r = $na % $nb;
$q = ($na - $r) / $nb;

assert(is_int($q));

return [
(string) $q,
Expand Down

0 comments on commit b51ec8a

Please sign in to comment.