Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Precise money #335

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
fix php 5.5 and hhvm
  • Loading branch information
frederikbosch committed Nov 29, 2016
commit 139c34617bc761e9854c5e4561e68d69840fbd6b
4 changes: 2 additions & 2 deletions src/Calculator/GmpCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ public function add($amount, $addend)

$integer = gmp_add($amount->getIntegerPart(), $addend->getIntegerPart());
if ($amount->isInteger()) {
return (string) $integer.'.'.$addend->getFractionalPart();
return gmp_strval($integer).'.'.$addend->getFractionalPart();
}

if ($addend->isInteger()) {
return (string) $integer.'.'.$amount->getFractionalPart();
return gmp_strval($integer).'.'.$amount->getFractionalPart();
}

$largestDigits = max(strlen($amount->getFractionalPart()), strlen($addend->getFractionalPart()));
Expand Down