Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Math.lgamma with input -0.0 #4299

Merged
merged 1 commit into from Nov 15, 2016
Merged

Fixed Math.lgamma with input -0.0 #4299

merged 1 commit into from Nov 15, 2016

Conversation

herwinw
Copy link

@herwinw herwinw commented Nov 15, 2016

There is a cornercase in Math.lgamma if the input is a negative zero.
This patch fixes it by adding that explicit corner case to the if
statement.

There is a cornercase in Math.lgamma if the input is a negative zero.
This patch fixes it by adding that explicit corner case to the if
statement.
@kares
Copy link
Member

kares commented Nov 15, 2016

you're right, MRI seems to do it this way :

2.3.1 :001 > Math.lgamma -0.0
 => [Infinity, -1] 
2.3.1 :002 > Math.lgamma 0.0
 => [Infinity, 1] 

@kares kares merged commit 978ffc2 into jruby:master Nov 15, 2016
@kares kares added the core label Nov 15, 2016
@kares kares added this to the JRuby 9.1.7.0 milestone Nov 15, 2016
@herwinw herwinw deleted the math_lgamma_negative_zero branch November 15, 2016 15:34
@headius
Copy link
Member

headius commented Nov 17, 2016

This appears to have broken a spec. Are the specs out of date?

     [exec] 1)
     [exec] Math.lgamma returns [Infinity, 1] when passed 0 FAILED
     [exec] Expected [Infinity, -1]
     [exec]  to equal [Infinity, 1]
     [exec] 
     [exec] /home/travis/build/jruby/jruby/spec/ruby/core/math/lgamma_spec.rb:5:in `block in (root)'
     [exec] org/jruby/RubyBasicObject.java:1689:in `instance_eval'
     [exec] org/jruby/RubyEnumerable.java:1586:in `all?'
     [exec] org/jruby/RubyFixnum.java:299:in `times'
     [exec] org/jruby/RubyArray.java:1734:in `each'
     [exec] /home/travis/build/jruby/jruby/spec/ruby/core/math/lgamma_spec.rb:3:in `<main>'
     [exec] org/jruby/RubyKernel.java:979:in `load'
     [exec] org/jruby/RubyBasicObject.java:1689:in `instance_eval'
     [exec] org/jruby/RubyArray.java:1734:in `each'

https://travis-ci.org/jruby/jruby/jobs/176560964

@headius
Copy link
Member

headius commented Nov 17, 2016

Move specs out of allowed failures when repaired.

headius added a commit that referenced this pull request Nov 17, 2016
headius added a commit that referenced this pull request Nov 17, 2016
headius added a commit that referenced this pull request Nov 17, 2016
headius added a commit that referenced this pull request Nov 17, 2016
@kares
Copy link
Member

kares commented Nov 17, 2016

in that case this caused a regression ... Math.lgamma returns [Infinity, 1] when passed 0 should be OK
will look into it

@headius
Copy link
Member

headius commented Nov 17, 2016

@kares Thanks! I undid the travis exclude and just tagged it btw.

kares added a commit to kares/jruby that referenced this pull request Nov 17, 2016
... reverting spec tagging at e07c718
kares added a commit that referenced this pull request Nov 17, 2016
... reverting spec tagging at e07c718
kares added a commit that referenced this pull request Nov 17, 2016
... reverting spec tagging at e07c718
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants