JRuby incorrectly calculates / and divmod against Rational number
-----------------------------------------------------------------

                 Key: JRUBY-1653
                 URL: http://jira.codehaus.org/browse/JRUBY-1653
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
         Environment: Jruby 1.1b1 (from latest trunk)
            Reporter: Vladimir Sizikov
            Priority: Critical
         Attachments: float_rational_updated.rb

=== example.rb =====
require 'rational'

puts 1.0.divmod Rational(1, 5)"
puts 1.0 / Rational(1, 5)"
=================

In MRI:
4 0.2
5.0

In JRuby:
NaN (FloatDomainError)
Infinity

This leads to errors in activesupport test cases, and in some time/date 
conversions where these two operations used frequently:

  2) Error:
test_xmlschema(DateTimeExtCalculationsTest):
FloatDomainError: Infinity
    /opt/work/jruby/lib/ruby/1.8/date/format.rb:600:in `scan'
    /opt/work/jruby/lib/ruby/1.8/date/format.rb:495:in `strftime'
    /opt/work/jruby/lib/ruby/1.8/date/format.rb:600:in `strftime'
    /opt/work/jruby/lib/ruby/1.8/date/format.rb:547:in `strftime'
    /opt/work/jruby/lib/ruby/1.8/date/format.rb:600:in `scan'
    /opt/work/jruby/lib/ruby/1.8/date/format.rb:495:in `strftime'
    /opt/work/jruby/lib/ruby/1.8/date/format.rb:600:in `strftime'
    
/opt/work/activesupport/./test/../lib/active_support/core_ext/date_time/conversions.rb:49:in
 `xmlschema'
    /opt/work/activesupport/./test/core_ext/date_time_ext_test.rb:206:in 
`test_xmlschema'

The proposed patch fixes the problem and the activesupport test case failure 
too.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to