-
Notifications
You must be signed in to change notification settings - Fork 19
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
$decimal->toInt() for -INF, INF, NAN give not correct result (zero) #11
Comments
This is intended, as it matches PHP behaviour. Ref: https://github.com/php-decimal/ext-decimal/blob/master/php_decimal.c#L780 |
Leaving this open because I am not convinced that matching PHP behaviour is the right way to go here. Thanks for bringing this up. 👍 |
I think PHP-way looks not relevant int this case. You throw OverflowException if the value is greater than PHP_INT_MAX (this seems ok). But, +INF is greater than PHP_INT_MAX. Therefore, +INF must give overfloaw too. Same for -INF, i suppose. |
This has been fixed in b1e0162 and released as v1.2.0 ✨ Throws |
Hello again.
I have found that $decimal->toInt() return 0 for -INF, INF and NAN.
I suppose, this is wrong. OverflowException seems to be correct for +-INF. And another exception (Invalid_Operation?) for NAN
The text was updated successfully, but these errors were encountered: