Math.atan 0.0/0.0 #313

Closed
ashbb opened this Issue Sep 26, 2012 · 6 comments

Projects

None yet

3 participants

@ashbb

I got the following outputs. The correct output of Math.atan 0.0/0.0 is NaN. Right?

C:\tmp>jruby -v
jruby 1.7.0.RC1 (1.9.3p203) 2012-09-25 8e849de on Java HotSpot(TM) Client VM 1.7
.0_03-b05 [Windows 7-x86]

C:\tmp>jruby -S irb
irb(main):001:0> 0.0/0.0
=> NaN
irb(main):002:0> Math.atan 0.0/0.0
Math::DomainError: Numerical argument is out of domain - "atan"
        from org/jruby/RubyMath.java:196:in `atan'
        from (irb):2:in `evaluate'
        from org/jruby/RubyKernel.java:1065:in `eval'
        from org/jruby/RubyKernel.java:1390:in `loop'
        from org/jruby/RubyKernel.java:1173:in `catch'
        from org/jruby/RubyKernel.java:1173:in `catch'
        from c:/jruby/bin/jirb:13:in `(root)'
C:\tmp>jruby --1.9 -v
jruby 1.6.7 (ruby-1.9.2-p312) (2012-02-22 3e82bc8) (Java HotSpot(TM) Client VM 1
.7.0_03) [Windows 7-x86-java]

C:\tmp>jruby --1.9 -S irb
irb(main):001:0> 0.0/0.0
=> NaN
irb(main):002:0> Math.atan 0.0/0.0
=> NaN
@BanzaiMan BanzaiMan was assigned Sep 26, 2012
@headius
JRuby Team member

Yes, appears we differ from MRI in how we're handling Math.atan(NaN) (and probably other Math methods.

@BanzaiMan
JRuby Team member

At one point, we had these special cases down. Ruby core moved on, but we haven't kept up.

@BanzaiMan
JRuby Team member

See rubyspec/rubyspec#156.

@BanzaiMan
JRuby Team member

See also affcd59.

@BanzaiMan BanzaiMan added a commit that closed this issue Oct 17, 2012
@BanzaiMan BanzaiMan Fixes #313 and other cases in various Math.* functions where NaN valu…
…es were handled differently.
6cc0ea8
@BanzaiMan BanzaiMan closed this in 6cc0ea8 Oct 17, 2012
@headius headius added a commit that referenced this issue Oct 17, 2012
@headius headius This commit caused some MRI tests to fail. Since we're close to
release, reverting until it can be reviewed.

Revert "Fixes #313 and other cases in various Math.* functions where NaN values were handled differently."

This reverts commit 6cc0ea8.
c81f6e0
@BanzaiMan BanzaiMan reopened this Oct 18, 2012
@BanzaiMan BanzaiMan added a commit that closed this issue Oct 19, 2012
@BanzaiMan BanzaiMan Fixes #313 and other cases in various Math.* functions where NaN valu…
…es were handled differently.
2fc5adf
@BanzaiMan BanzaiMan closed this in 2fc5adf Oct 19, 2012
@BanzaiMan
JRuby Team member

Github autocloses the issue even the comment is on a non-master branch. That's brilliant.

@BanzaiMan BanzaiMan reopened this Oct 19, 2012
@BanzaiMan BanzaiMan added a commit that closed this issue Oct 19, 2012
@BanzaiMan BanzaiMan Fixes #313 and other cases in various Math.* functions where NaN valu…
…es were handled differently.
94ea870
@BanzaiMan BanzaiMan closed this in 94ea870 Oct 19, 2012
@BanzaiMan BanzaiMan reopened this Oct 19, 2012
@headius
JRuby Team member

This is now on post17 branch and will be merged to master for 1.7.1.

@headius headius closed this Oct 19, 2012
@BanzaiMan BanzaiMan added a commit that referenced this issue Oct 25, 2012
@BanzaiMan BanzaiMan Fixes #313 and other cases in various Math.* functions where NaN valu…
…es were handled differently.
05bea3c
@prathamesh-sonpatki prathamesh-sonpatki added a commit to prathamesh-sonpatki/jruby that referenced this issue Dec 3, 2012
@BanzaiMan BanzaiMan Fixes #313 and other cases in various Math.* functions where NaN valu…
…es were handled differently.
821fe56
@prathamesh-sonpatki prathamesh-sonpatki added a commit to prathamesh-sonpatki/jruby that referenced this issue Dec 3, 2012
@headius headius This commit caused some MRI tests to fail. Since we're close to
release, reverting until it can be reviewed.

Revert "Fixes #313 and other cases in various Math.* functions where NaN values were handled differently."

This reverts commit 6cc0ea8.
2cab2f2
@prathamesh-sonpatki prathamesh-sonpatki added a commit to prathamesh-sonpatki/jruby that referenced this issue Dec 3, 2012
@BanzaiMan BanzaiMan Fixes #313 and other cases in various Math.* functions where NaN valu…
…es were handled differently.
727aeb3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment