You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2021/09/19 08:26:38 UTC
[commons-statistics] branch master updated: Avoid divide by using
negation of exponent
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-statistics.git
The following commit(s) were added to refs/heads/master by this push:
new 40d46f1 Avoid divide by using negation of exponent
40d46f1 is described below
commit 40d46f120ec8c7111e22f78c6cd710ab3b0dcd6f
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Sun Sep 19 09:26:36 2021 +0100
Avoid divide by using negation of exponent
---
.../org/apache/commons/statistics/distribution/ZipfDistribution.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ZipfDistribution.java b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ZipfDistribution.java
index 60e0261..0674b70 100644
--- a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ZipfDistribution.java
+++ b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/ZipfDistribution.java
@@ -93,7 +93,7 @@ public class ZipfDistribution extends AbstractDiscreteDistribution {
return 0;
}
- return (1 / Math.pow(x, exponent)) / nthHarmonic;
+ return Math.pow(x, -exponent) / nthHarmonic;
}
/** {@inheritDoc} */