divmod with 0.0 argument should raise FloatDomainError: NaN
-----------------------------------------------------------

                 Key: JRUBY-1934
                 URL: http://jira.codehaus.org/browse/JRUBY-1934
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1RC1
         Environment: Latest JRuby 1.1RC1 from trunk
            Reporter: Vladimir Sizikov
         Attachments: divmod-with-float-zero.patch

For, Float, Fixnum, Bignum, divmod with (0.0) should result in 
FloatDomainError: NaN.

{noformat}
(2**100).divmod(0.0)
(200.0).divmod(0.0)
(2).divmod(0.0)
{noformat}

In MRI, all the lines above produce:
FloatDomainError: NaN
FloatDomainError: NaN
FloatDomainError: NaN

In JRuby:
FloatDomainError: Infinity
FloatDomainError: Infinity
FloatDomainError: Infinity

This also leads to one rubyspec failure:
1)
Bignum#divmod raises a FloatDomainError when the given argument is 0 and a 
Float FAILED
Expected FloatDomainError (NaN) but got FloatDomainError (Infinity):
./mspec/expectations.rb:10:in `fail_with'
./mspec/expectations/should.rb:6:in `should'
/opt/work/rubinius/./spec/ruby/1.8/core/bignum/divmod_spec.rb:26
tmp/last_ci.rb:52:in `call'
./mspec/runner/runner.rb:136:in `describe'
./mspec/runner/object.rb:11:in `each'
./mspec/runner/runner.rb:130:in `describe'
./mspec/runner/object.rb:11:in `describe'
/opt/work/rubinius/./spec/ruby/1.8/core/bignum/divmod_spec.rb:4
tmp/last_ci.rb:52:in `load'
tmp/last_ci.rb:52
tmp/last_ci.rb:1:in `each'
tmp/last_ci.rb:44

The proposed patch fixes the problem.

-- 
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