-
Notifications
You must be signed in to change notification settings - Fork 161
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
ROUND does not work properly for inline floats #172
Comments
ROUNDUP and ROUNDDOWN work as expected. |
When parsing numeric literals, the value will either become an integer or a BigDecimal (see token_scanner.rb:94), and rounding a BigDecimal still returns a BigDecimal. On the other hand, context values are used as-is without any conversion, so the second result is still a float. ROUNDUP/DOWN use floor or ceil on the scaled value and then divide by a float, so they will always coerce to float. Maybe it would be more consistent to always force numeric functions to return integer or BigDecimal? |
BigDecimal would be much better and much more natural imho. |
Not rushing but any changes here? :) |
Not so far, but I'll try to take a look at this soon. |
Thank you. Don't hesitate if you need any help! |
Given rule like that:
ROUND(1.23456789, 3)
executing Dentaku like so:what is surprising is the argument is not an inline:
The text was updated successfully, but these errors were encountered: