What does /2 represent in a division calclulation ....hangs console

0 views
Skip to first unread message

Doug

unread,
Nov 9, 2009, 1:48:55 PM11/9/09
to Ruby on Rails: Talk
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

unread,
Nov 9, 2009, 2:22:54 PM11/9/09
to rubyonra...@googlegroups.com

Looks like it thinks you've started a regular expression.

> thanks

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
--
Posted via http://www.ruby-forum.com/.

Reply all
Reply to author
Forward
0 new messages