Fixed Math.lgamma with input -0.0 #4299

Merged
merged 1 commit into from Nov 15, 2016

Projects

None yet

3 participants

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

Herwin Weststrate Fixed Math.lgamma with input -0.0
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.
1605ff0
@kares
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

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/appveyor/pr AppVeyor build failed
Details
@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 herwinw:math_lgamma_negative_zero branch Nov 15, 2016
@headius
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
Member
headius commented Nov 17, 2016

Move specs out of allowed failures when repaired.

@headius headius added a commit that referenced this pull request Nov 17, 2016
@headius headius Revert "Allow specs to fail until regression from #4299 is fixed."
This reverts commit a942825.
0b3290f
@headius headius added a commit that referenced this pull request Nov 17, 2016
@headius headius Tag failing Math.lgamma spec. #4299 e07c718
@headius headius added a commit that referenced this pull request Nov 17, 2016
@headius headius Revert "Allow specs to fail until regression from #4299 is fixed."
This reverts commit a942825.
d548472
@headius headius added a commit that referenced this pull request Nov 17, 2016
@headius headius Tag failing Math.lgamma spec. #4299 f2f2ca2
@kares
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
Member
headius commented Nov 17, 2016

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

@kares kares added a commit to kares/jruby that referenced this pull request Nov 17, 2016
@kares kares add a working fix for #4299
... reverting spec tagging at e07c718
ae6d720
@kares kares added a commit that referenced this pull request Nov 17, 2016
@kares kares add a working fix for #4299
... reverting spec tagging at e07c718
94ac35e
@kares kares added a commit that referenced this pull request Nov 17, 2016
@kares kares add a working fix for #4299
... reverting spec tagging at e07c718
2f60a32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment