summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-10 00:20:02 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-10 00:20:02 (GMT)
commit7573452099e010ccf5ac26cb56e0172046671f91 (patch)
treefd589b00da0c8525b2b62625a4c32dca45dfb3b2 /math.c
parent6ad7c53ba9fb688ea1070a2319a64f0cc32c08e8 (diff)
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
Diffstat (limited to 'math.c')
-rw-r--r--math.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/math.c b/math.c
index 5e2cbe9..7be5115 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;
}
}