How do you round a float to 2 decimal places in JRuby?
jruby, rounding, ruby
Solution
Float#round can take a parameter in Ruby 1.9, not in Ruby 1.8. JRuby defaults to 1.8, but it is capable of running in 1.9 mode.
Problem
How do you round a float to 2 decimal places in JRuby(1.6.x)? ``` number = 1.1164 number.round(2) # The above shows the following error # wrong number of arguments (1 for 0) ```