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 2019/12/02 00:40:34 UTC
[commons-statistics] 02/03: Removed condition that was always true.
This is an automated email from the ASF dual-hosted git repository.
erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-statistics.git
commit 852ad1a38ad842b04b4e91b531c4832168fd2c81
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Mon Dec 2 01:21:11 2019 +0100
Removed condition that was always true.
Reported by "sonarcloud.io".
---
.../commons/statistics/distribution/TriangularDistribution.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TriangularDistribution.java b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TriangularDistribution.java
index 530fd09..7631220 100644
--- a/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TriangularDistribution.java
+++ b/commons-statistics-distribution/src/main/java/org/apache/commons/statistics/distribution/TriangularDistribution.java
@@ -91,7 +91,7 @@ public class TriangularDistribution extends AbstractContinuousDistribution {
if (x < a) {
return 0;
}
- if (a <= x && x < c) {
+ if (x < c) {
final double divident = 2 * (x - a);
final double divisor = (b - a) * (c - a);
return divident / divisor;
@@ -99,7 +99,7 @@ public class TriangularDistribution extends AbstractContinuousDistribution {
if (x == c) {
return 2 / (b - a);
}
- if (c < x && x <= b) {
+ if (x <= b) {
final double divident = 2 * (b - x);
final double divisor = (b - a) * (b - c);
return divident / divisor;
@@ -125,7 +125,7 @@ public class TriangularDistribution extends AbstractContinuousDistribution {
if (x < a) {
return 0;
}
- if (a <= x && x < c) {
+ if (x < c) {
final double divident = (x - a) * (x - a);
final double divisor = (b - a) * (c - a);
return divident / divisor;
@@ -133,7 +133,7 @@ public class TriangularDistribution extends AbstractContinuousDistribution {
if (x == c) {
return (c - a) / (b - a);
}
- if (c < x && x <= b) {
+ if (x <= b) {
final double divident = (b - x) * (b - x);
final double divisor = (b - a) * (b - c);
return 1 - (divident / divisor);