Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Math.atan 0.0/0.0 #313

Closed
ashbb opened this Issue · 6 comments

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
@headius
Owner

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

@BanzaiMan
Owner

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

@BanzaiMan
Owner

See also affcd59.

@BanzaiMan BanzaiMan closed this in 6cc0ea8
@headius headius referenced this issue from a commit
@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
@BanzaiMan BanzaiMan closed this in 2fc5adf
@BanzaiMan
Owner

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

@BanzaiMan BanzaiMan reopened this
@BanzaiMan BanzaiMan closed this in 94ea870
@BanzaiMan BanzaiMan reopened this
@headius
Owner

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

@headius headius closed this
@BanzaiMan BanzaiMan referenced this issue from a commit
@BanzaiMan BanzaiMan Fixes #313 and other cases in various Math.* functions where NaN valu…
…es were handled differently.
05bea3c
@prathamesh-sonpatki prathamesh-sonpatki referenced this issue from a commit in prathamesh-sonpatki/jruby
@BanzaiMan BanzaiMan Fixes #313 and other cases in various Math.* functions where NaN valu…
…es were handled differently.
821fe56
@prathamesh-sonpatki prathamesh-sonpatki referenced this issue from a commit in prathamesh-sonpatki/jruby
@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 referenced this issue from a commit in prathamesh-sonpatki/jruby
@BanzaiMan BanzaiMan Fixes #313 and other cases in various Math.* functions where NaN valu…
…es were handled differently.
727aeb3
@lukefx lukefx referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@lukefx lukefx referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@martinott martinott referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.