You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And I was getting: PHP Fatal error: Uncaught Brick\Math\Exception\RoundingNecessaryException: Rounding is necessary to represent the result of the operation at this scale.
Which I didn't expect because 1/10 doesn't yield infinite decimals.
After some digging, I found out that some piece of my code had changed de bcscale to 8 and Brick\Math\Internal\Calculator\BcMathCalculator::mod was returning '0.00000000' instead of '0', which caused Brick\Math\Internal\Calculator::divRound() to throw the exception since '0.00000000' === '0' is false of course (lines 435, 449).
I found out that since php7.2 (I was using php7.4), the bcmod function accepts a third parameter for the scale, which I think maybe could be used to prevent an error like this? Although I see the library still supports php7.1, so maybe it's not possible
The text was updated successfully, but these errors were encountered:
I had something like this:
And I was getting:
PHP Fatal error: Uncaught Brick\Math\Exception\RoundingNecessaryException: Rounding is necessary to represent the result of the operation at this scale.
Which I didn't expect because 1/10 doesn't yield infinite decimals.
After some digging, I found out that some piece of my code had changed de bcscale to 8 and Brick\Math\Internal\Calculator\BcMathCalculator::mod was returning '0.00000000' instead of '0', which caused Brick\Math\Internal\Calculator::divRound() to throw the exception since '0.00000000' === '0' is false of course (lines 435, 449).
I found out that since php7.2 (I was using php7.4), the bcmod function accepts a third parameter for the scale, which I think maybe could be used to prevent an error like this? Although I see the library still supports php7.1, so maybe it's not possible
The text was updated successfully, but these errors were encountered: