[Rails] 12 / 16 = 0

Erik van Oosten e.vanoosten at chello.nl
Mon Apr 3 07:26:15 GMT 2006


irb(main):001:0> 12.quo(16)
=> 0.75

     Erik.


Jeroen Houben schreef:
> Hi,
>
> Just thought it was weird that Ruby doesn't automatically cast ints to 
> floats. Seems so un-rubyish
>
> irb(main):006:0> 12/16
> => 0
> irb(main):007:0> 12.to_f / 16.to_f
> => 0.75
>
> Jeroen
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


More information about the Rails mailing list