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 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Hi Keerthi, Following is useful for you (2.3465*100).round / 100.0 Note: Don''t forget .0 for 100 Thanks & Regards, Vijay On Wed, Sep 12, 2012 at 11:55 AM, keerthi priya < emailtokeerthipriya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
@Vijay it did not work On Wed, Sep 12, 2012 at 12:21 PM, vijaya sekhar reddy mallidi < m.vijaysekhar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Keerthi, > > Following is useful for you > > (2.3465*100).round / 100.0 > > Note: Don''t forget .0 for 100 > > Thanks & Regards, > Vijay > > On Wed, Sep 12, 2012 at 11:55 AM, keerthi priya < > emailtokeerthipriya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 >> >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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. >> >> >> > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 12 September 2012 10:25, keerthi priya <emailtokeerthipriya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> @Vijay it did not workIt is no good saying "it did not work". Show us what you did and what the result was and what you expected. Copy/paste it from the console so we can see exactly what happened. Colin> > On Wed, Sep 12, 2012 at 12:21 PM, vijaya sekhar reddy mallidi > <m.vijaysekhar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> Hi Keerthi, >> >> Following is useful for you >> >> (2.3465*100).round / 100.0 >> >> Note: Don''t forget .0 for 100 >> >> Thanks & Regards, >> Vijay >> >> On Wed, Sep 12, 2012 at 11:55 AM, keerthi priya >> <emailtokeerthipriya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 >>> >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> 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. >>> >>> >> >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Wed, Sep 12, 2012 at 4:25 PM, keerthi priya < emailtokeerthipriya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
This is my console code irb(main):001:0> (2.08*100).round / 100.0 => 2.08 but i what i was expecting is like if i give input as 2.08 i need my output as 2.1 and i give i/p as 2.04 i need my output as 2.0 On Wed, Sep 12, 2012 at 3:02 PM, Jim Ruther Nill <jvnill-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Wed, Sep 12, 2012 at 4:25 PM, keerthi priya < > emailtokeerthipriya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Wed, Sep 12, 2012 at 7:40 PM, keerthi priya < emailtokeerthipriya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> This is my console code > > irb(main):001:0> (2.08*100).round / 100.0 > => 2.08 > > but i what i was expecting is like if i give input as 2.08 i need my > output as 2.1 and i give i/p as 2.04 i need my output as 2.0you just need to change 100 to 10 1.9.3p194 :004 > (2.08 * 10).round / 10.0 => 2.1> > > > On Wed, Sep 12, 2012 at 3:02 PM, Jim Ruther Nill <jvnill-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> >> >> On Wed, Sep 12, 2012 at 4:25 PM, keerthi priya < >> emailtokeerthipriya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
This might be help full http://stackoverflow.com/questions/884512/how-to-cap-and-round-number-in-ruby On Wed, Sep 12, 2012 at 3:16 PM, Jim Ruther Nill <jvnill-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Wed, Sep 12, 2012 at 7:40 PM, keerthi priya < > emailtokeerthipriya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> This is my console code >> >> irb(main):001:0> (2.08*100).round / 100.0 >> => 2.08 >> >> but i what i was expecting is like if i give input as 2.08 i need my >> output as 2.1 and i give i/p as 2.04 i need my output as 2.0 > > > you just need to change 100 to 10 > > 1.9.3p194 :004 > (2.08 * 10).round / 10.0 > => 2.1 > > > >> >> >> >> On Wed, Sep 12, 2012 at 3:02 PM, Jim Ruther Nill <jvnill-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >> >>> >>> >>> On Wed, Sep 12, 2012 at 4:25 PM, keerthi priya < >>> emailtokeerthipriya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org. >>>> To unsubscribe from this group, send email to >>>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- *"•▬●๋•ýáککhừ•▬•●๋ ╰» єριтσмє σƒ ℓσνє..."* -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
I got it what i need thanks all. On Wed, Sep 12, 2012 at 3:16 PM, Jim Ruther Nill <jvnill-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Wed, Sep 12, 2012 at 7:40 PM, keerthi priya < > emailtokeerthipriya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> This is my console code >> >> irb(main):001:0> (2.08*100).round / 100.0 >> => 2.08 >> >> but i what i was expecting is like if i give input as 2.08 i need my >> output as 2.1 and i give i/p as 2.04 i need my output as 2.0 > > > you just need to change 100 to 10 > > 1.9.3p194 :004 > (2.08 * 10).round / 10.0 > => 2.1 > > > >> >> >> >> On Wed, Sep 12, 2012 at 3:02 PM, Jim Ruther Nill <jvnill-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote: >> >>> >>> >>> On Wed, Sep 12, 2012 at 4:25 PM, keerthi priya < >>> emailtokeerthipriya-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> To unsubscribe from this group, send email to >>>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to >>> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To unsubscribe from this group, send email to >> rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.