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

Conversation

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

This comment has been minimized.

Show comment
Hide comment
@kares

kares Nov 15, 2016

Member

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

This comment has been minimized.

Show comment
Hide comment
@headius

headius Nov 17, 2016

Member

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

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 added a commit that referenced this pull request Nov 17, 2016

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Nov 17, 2016

Member

Move specs out of allowed failures when repaired.

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

This comment has been minimized.

Show comment
Hide comment
@kares

kares Nov 17, 2016

Member

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

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

This comment has been minimized.

Show comment
Hide comment
@headius

headius Nov 17, 2016

Member

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

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

add a working fix for #4299
... reverting spec tagging at e07c718

kares added a commit that referenced this pull request Nov 17, 2016

add a working fix for #4299
... reverting spec tagging at e07c718

kares added a commit that referenced this pull request Nov 17, 2016

add a working fix for #4299
... reverting spec tagging at e07c718
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment