From 7573452099e010ccf5ac26cb56e0172046671f91 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 10 May 2017 00:20:02 +0000 Subject: [PATCH] math.c (ruby_lgamma_r): reduce duplicate code git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- math.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/math.c b/math.c index 5e2cbe9b74..7be5115b7e 100644 --- a/math.c +++ b/math.c @@ -800,11 +800,8 @@ ruby_lgamma_r(const double d, int *sign) { const double g = lgamma_r(d, sign); if (isinf(g)) { - if (d == 0.0 && signbit(d)) { - *sign = -1; - return INFINITY; - } else if (d == 0.0 && !signbit(d)) { - *sign = 1; + if (d == 0.0) { + *sign = signbit(d) ? -1 : +1; return INFINITY; } }