On Wed, Sep 12, 2012 at 4:25 PM, keerthi priya < emailtokeerthipr...@gmail.com> wrote:
> Hi all > i am trying to use round method if have a value 2.08 i want it as 2.1 and > it worked in 1.9.2 but not in 1.8.7 is there any other way of doing it. > > > USING 1.9.2 > > 1.9.2p320 :001 > 2.08.round(1) > => 2.1 > 1.9.2p320 :002 > 2.04.round(1) > => 2.0 > > USING 1.8.7 > > irb(main):001:0> 2.08.round > => 2 > irb(main):002:0> 2.08.round(1) > ArgumentError: wrong number of arguments (1 for 0) > from (irb):2:in `round' > from (irb):2 > from :0 > i can able to use round but not with one decimal > > Can any tell how can i get round(1) in 1.8.7 > I think this thread explains vijaya's answer better http://stackoverflow.com/questions/2054217/rounding-float-in-ruby > > Cheers, > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/Xj8YzOKl2oAJ. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.