Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Division by zero warning in innerLog10 #60

Closed
precariouspanther opened this issue Aug 21, 2017 · 0 comments · Fixed by #61
Closed

Division by zero warning in innerLog10 #60

precariouspanther opened this issue Aug 21, 2017 · 0 comments · Fixed by #61

Comments

@precariouspanther
Copy link
Contributor

Two previous tickets have resolved other division by zero issues in the innerLog10 method, however we've encountered another when dealing with Decimals created from floats when the precision is being calculated to a higher value than the 'length'. This results in a negative $value_log10_approx which triggers a division by zero warning in \bcdiv:

image

To replicate:

$x = Decimal::fromFloat(1.001);
// PHP Warning:  bcdiv(): Division by zero in /vendor/litipk/php-bignumbers/src/Decimal.php on line 1159
$x->div(Decimal::fromFloat(1.0));
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant