-
Notifications
You must be signed in to change notification settings - Fork 188
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
Numeric#round(n, mode) - round modes are not supported #1509
Comments
Thanks for the report. TruffleRuby does work with some round modes. It passes all the BigDecimal#round specs. It looks like the symbol-based modes are problematic. We probably need a lookup table to translate them to integer values. It shouldn't be too difficult. It looks like we should also improve the Ruby Spec Suite by adding more cases to test. |
Are you sure that's supposed to work though? In MRI 2.4.x and 2.5.x, I get an
So it looks like we might just need raise an |
@nirvdrum You have a typo. It's |
Right you are. I messed up translating |
@eregon @chrisseaton Could this be a priority for RC14, please? In fact, this is one of issues why I started to report bugs in TruffleRuby. I'd like to run a quite trivial script importing exchange rates on TruffleRuby one day :) |
Sorry this hasn't managed to go into RC15, but we have a lot of time scheduled this month to look at this issue backlog. |
Working on this now. |
Fix for this done and on the way. |
Fixed in 0beec8a. |
At least Ruby 2.4 supports several round modes. See https://ruby-doc.org/stdlib-2.4.0/libdoc/bigdecimal/rdoc/BigDecimal.html#method-c-mode
Unfortunately, TruffleRuby triggers
TypeError: Truffle doesn't have a case for the org.truffleruby.stdlib.bigdecimal.BigDecimalNodesFactory$RoundNodeFactory$RoundNodeGen node with values of type
exception with any used round mode.To reproduce:
Error:
The text was updated successfully, but these errors were encountered: