Dividing Float by Rational number results in a Fixnum with JRuby and a Float with MRI . This should be consistent between platforms, I guess the MRI behavior makes more sense and JRuby should be fixed. I would be glad to help resolving this, if only some JRuby guru gives me a few tips on where to look.
To reproduce try the following code
require "rational"
result = Float(10) / 20
puts "10.0 divided by 20 equals #{result} (#{result.class})"
result = Float(10) / Rational(20)
puts "10.0 divided by rational 20 equals #{result} (#{result.class})"
When run with MRI this prints
% ruby bug.rb
10.0 divided by 20 equals 0.5 (Float)
10.0 divided by rational 20 equals 0.5 (Float)
Tested with
% ruby -v
ruby 1.8.5 (2006-12-25 patchlevel 12) [i686-darwin]
and
$ ruby -v
ruby 1.8.6 (2007-06-07 patchlevel 36) [i486-linux]
But when run with JRuby this prints
% jruby bug.rb
10.0 divided by 20 equals 0.5 (Float)
10.0 divided by rational 20 equals 0 (Fixnum)
% jruby -v bug.rb
ruby 1.8.6 (2008-03-18 rev 6255) [i386-jruby1.1RC3]