Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Numeric#round(n, mode) - round modes are not supported #1509
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
require 'bigdecimal' BigDecimal('1.516').round(2, :half_even)
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