-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath_22.diff
76 lines (75 loc) · 5.15 KB
/
math_22.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
diff --git a/src/main/java/org/apache/commons/math3/distribution/FDistribution.java b/src/main/java/org/apache/commons/math3/distribution/FDistribution.java
index 8b0993c4d..9c57c8224 100644
--- a/src/main/java/org/apache/commons/math3/distribution/FDistribution.java
+++ b/src/main/java/org/apache/commons/math3/distribution/FDistribution.java
@@ -126,6 +126,33 @@ public class FDistribution extends AbstractRealDistribution {
* @since 2.1
*/
public double density(double x) {
+ if (Boolean.parseBoolean(System.getProperty("defects4j.instrumentation.enabled"))) { // defects4j.instrumentation
+ double returnValue = density_original(x); // defects4j.instrumentation
+ double upperBound = getSupportUpperBound(); // defects4j.instrumentation
+ double lowerBound = getSupportLowerBound(); // defects4j.instrumentation
+ if (x == upperBound) { // defects4j.instrumentation
+ boolean upperBoundRule = !isSupportUpperBoundInclusive() || !Double.isInfinite(returnValue) && !Double.isNaN(returnValue); // defects4j.instrumentation
+ if (!upperBoundRule) { // defects4j.instrumentation
+ throw new RuntimeException("[Defects4J_BugReport_Violation]"); // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ return returnValue; // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } else if (x == lowerBound) { // defects4j.instrumentation
+ boolean lowerBoundRule = !isSupportLowerBoundInclusive() || !Double.isInfinite(returnValue) && !Double.isNaN(returnValue); // defects4j.instrumentation
+ if (!lowerBoundRule) { // defects4j.instrumentation
+ throw new RuntimeException("[Defects4J_BugReport_Violation]"); // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ return returnValue; // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ return returnValue; // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ return density_original(x); // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } // defects4j.instrumentation
+
+ public double density_original(double x) { // defects4j.instrumentation
final double nhalf = numeratorDegreesOfFreedom / 2;
final double mhalf = denominatorDegreesOfFreedom / 2;
final double logx = FastMath.log(x);
diff --git a/src/main/java/org/apache/commons/math3/distribution/UniformRealDistribution.java b/src/main/java/org/apache/commons/math3/distribution/UniformRealDistribution.java
index 5d32f6ebf..ae6afafd8 100644
--- a/src/main/java/org/apache/commons/math3/distribution/UniformRealDistribution.java
+++ b/src/main/java/org/apache/commons/math3/distribution/UniformRealDistribution.java
@@ -106,6 +106,33 @@ public class UniformRealDistribution extends AbstractRealDistribution {
/** {@inheritDoc} */
public double density(double x) {
+ if (Boolean.parseBoolean(System.getProperty("defects4j.instrumentation.enabled"))) { // defects4j.instrumentation
+ double returnValue = density_original(x); // defects4j.instrumentation
+ double upperBound = getSupportUpperBound(); // defects4j.instrumentation
+ double lowerBound = getSupportLowerBound(); // defects4j.instrumentation
+ if (x == upperBound) { // defects4j.instrumentation
+ boolean upperBoundRule = !isSupportUpperBoundInclusive() || !Double.isInfinite(returnValue) && !Double.isNaN(returnValue); // defects4j.instrumentation
+ if (!upperBoundRule) { // defects4j.instrumentation
+ throw new RuntimeException("[Defects4J_BugReport_Violation]"); // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ return returnValue; // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } else if (x == lowerBound) { // defects4j.instrumentation
+ boolean lowerBoundRule = !isSupportLowerBoundInclusive() || !Double.isInfinite(returnValue) && !Double.isNaN(returnValue); // defects4j.instrumentation
+ if (!lowerBoundRule) { // defects4j.instrumentation
+ throw new RuntimeException("[Defects4J_BugReport_Violation]"); // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ return returnValue; // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ return returnValue; // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ return density_original(x); // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } // defects4j.instrumentation
+
+ public double density_original(double x) { // defects4j.instrumentation
if (x < lower || x > upper) {
return 0.0;
}