commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [21/50] commons-rng git commit: Clear PMD warnings.
Date Tue, 29 Nov 2016 11:32:32 GMT
Clear PMD warnings.


Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/5a198a8b
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/5a198a8b
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/5a198a8b

Branch: refs/heads/1.0-release
Commit: 5a198a8bb346dae079cbb8f2177d3196d20b5bb6
Parents: db710d4
Author: Gilles <erans@apache.org>
Authored: Fri Nov 25 16:19:50 2016 +0100
Committer: Gilles <erans@apache.org>
Committed: Fri Nov 25 16:19:50 2016 +0100

----------------------------------------------------------------------
 .../apache/commons/rng/sampling/distribution/InternalGamma.java    | 2 +-
 .../apache/commons/rng/sampling/distribution/PoissonSampler.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-rng/blob/5a198a8b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InternalGamma.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InternalGamma.java
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InternalGamma.java
index 17ee050..1421f0a 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InternalGamma.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/InternalGamma.java
@@ -113,7 +113,7 @@ class InternalGamma { // Class is package-private on purpose; do not make
it pub
 
         final double sum = lanczos(x);
         final double tmp = x + LANCZOS_G + 0.5;
-        return ((x + 0.5) * Math.log(tmp)) - tmp +  HALF_LOG_2_PI + Math.log(sum / x);
+        return (x + 0.5) * Math.log(tmp) - tmp +  HALF_LOG_2_PI + Math.log(sum / x);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-rng/blob/5a198a8b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
index 7692ebf..9ac3249 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
@@ -133,7 +133,7 @@ public class PoissonSampler
                     }
                     y = x < 0 ? Math.floor(x) : Math.ceil(x);
                     final double e = exponential.sample();
-                    v = -e - (n * n / 2) + c1;
+                    v = -e - 0.5 * n * n + c1;
                 } else {
                     if (u > p1 + p2) {
                         y = lambda;


Mime
View raw message