Doug
2009-Nov-09 18:48 UTC
What does /2 represent in a division calclulation ....hangs console
what does /2 or /5.5 represent to ruby? in a division caclulation: x / 5.5 if you only put a space between x and the /, then the console hangs in irb it does this: irb(main):014:0> x = BigDecimal("10.00") => #<BigDecimal:31a5ccc,''0.1E2'',4(8)> irb(main):015:0> x * 5 => #<BigDecimal:31a3760,''0.5E2'',4(16)> irb(main):016:0> x / 2 => #<BigDecimal:31a11a4,''0.5E1'',4(32)> irb(main):017:0> x /2 irb(main):018:0/ x/2 => #<BigDecimal:319e24c,''0.5E1'',4(32)> irb(main):019:0> x /2.5 irb(main):020:0/ thanks
Marnen Laibow-Koser
2009-Nov-09 19:22 UTC
Re: What does /2 represent in a division calclulation ....ha
Doug wrote:> what does /2 or /5.5 represent to ruby? > > in a division caclulation: x / 5.5 > > if you only put a space between x and the /, then > the console hangs > in irb it does this: > > irb(main):014:0> x = BigDecimal("10.00") > => #<BigDecimal:31a5ccc,''0.1E2'',4(8)> > irb(main):015:0> x * 5 > => #<BigDecimal:31a3760,''0.5E2'',4(16)> > irb(main):016:0> x / 2 > => #<BigDecimal:31a11a4,''0.5E1'',4(32)> > irb(main):017:0> x /2 > irb(main):018:0/ x/2 > => #<BigDecimal:319e24c,''0.5E1'',4(32)> > irb(main):019:0> x /2.5 > irb(main):020:0/ >Looks like it thinks you''ve started a regular expression.> thanksBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.