From: Gary Wright Date: 2009-04-15T02:39:14+09:00 Subject: Re: Argument types On Apr 14, 2009, at 1:10 PM, Florian Kaufmann wrote: >> An index is always a natural number. It is required to be either a >> Fixnum or >> Bignum. You can't pass arbitrary object to those methods. > > It seems that it is more complex than that. This works > > %w(a b c)[1.2] Because Float#.to_int is defined, although I'm not quite sure why. This caused me to notice: Float#ceil to greater (or equal) integer Float#floor to smaller (or equal) integer Float#to_int floor but towards towards zero (i.e. smaller abs value) -0.5.to_int == 0, 0.5.to_int == 0 -0.6.to_int == 0, 0.6.to_int == 0 Float#round rounds away from zero: -0.5.round == -1, 0.5.round == 1