You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2017/05/11 12:03:43 UTC
[15/18] commons-numbers git commit: Unnecessary variable.
Unnecessary variable.
Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/5944675f
Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/5944675f
Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/5944675f
Branch: refs/heads/master
Commit: 5944675f3f3e00b462ee9b44c6f986a3cb65229b
Parents: 842119c
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
Authored: Tue May 9 17:06:00 2017 +0200
Committer: Gilles Sadowski <gi...@harfang.homelinux.org>
Committed: Tue May 9 17:06:00 2017 +0200
----------------------------------------------------------------------
.../java/org/apache/commons/numbers/gamma/Gamma.java | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/5944675f/commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma/Gamma.java
----------------------------------------------------------------------
diff --git a/commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma/Gamma.java b/commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma/Gamma.java
index 8906734..1cd5424 100644
--- a/commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma/Gamma.java
+++ b/commons-numbers-gamma/src/main/java/org/apache/commons/numbers/gamma/Gamma.java
@@ -55,7 +55,6 @@ public class Gamma {
return Double.NaN;
}
- final double ret;
final double absX = Math.abs(x);
if (absX <= 20) {
if (x >= 1) {
@@ -73,7 +72,7 @@ public class Gamma {
t -= 1;
prod *= t;
}
- ret = prod / (1 + INV_GAMMA_1P_M1.value(t - 1));
+ return prod / (1 + INV_GAMMA_1P_M1.value(t - 1));
} else {
/*
* From the recurrence relation
@@ -88,7 +87,7 @@ public class Gamma {
t += 1;
prod *= t;
}
- ret = 1 / (prod * (1 + INV_GAMMA_1P_M1.value(t)));
+ return 1 / (prod * (1 + INV_GAMMA_1P_M1.value(t)));
}
} else {
final double y = absX + LANCZOS_G + 0.5;
@@ -96,7 +95,7 @@ public class Gamma {
Math.pow(y, absX + 0.5) *
Math.exp(-y) * LANCZOS_APPROXIMATION.value(absX);
if (x > 0) {
- ret = gammaAbs;
+ return gammaAbs;
} else {
/*
* From the reflection formula
@@ -106,10 +105,8 @@ public class Gamma {
* it is found
* Gamma(x) = -pi / [x * sin(pi * x) * Gamma(-x)].
*/
- ret = -Math.PI / (x * Math.sin(Math.PI * x) * gammaAbs);
+ return -Math.PI / (x * Math.sin(Math.PI * x) * gammaAbs);
}
}
-
- return ret;
}
}