-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath_53.diff
26 lines (26 loc) · 1.61 KB
/
math_53.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
diff --git a/src/main/java/org/apache/commons/math/complex/Complex.java b/src/main/java/org/apache/commons/math/complex/Complex.java
index e0a8e97e9..b43316398 100644
--- a/src/main/java/org/apache/commons/math/complex/Complex.java
+++ b/src/main/java/org/apache/commons/math/complex/Complex.java
@@ -147,7 +147,20 @@ public class Complex implements FieldElement<Complex>, Serializable {
* @return the complex number sum
* @throws NullArgumentException if <code>rhs</code> is null
*/
- public Complex add(Complex rhs)
+ public Complex add(Complex rhs) throws NullArgumentException { // defects4j.instrumentation
+ if (Boolean.parseBoolean(System.getProperty("defects4j.instrumentation.enabled"))) { // defects4j.instrumentation
+ Complex result = add_original(rhs); // defects4j.instrumentation
+ if ((this.isNaN() || rhs.isNaN()) // defects4j.instrumentation
+ && !(Double.isNaN(result.getReal()) && Double.isNaN(result.getImaginary()))) { // defects4j.instrumentation
+ throw new RuntimeException("[Defects4J_BugReport_Violation]"); // defects4j.instrumentation
+ } // defects4j.instrumentation
+ return result; // defects4j.instrumentation
+ } else { // defects4j.instrumentation
+ return add_original(rhs); // defects4j.instrumentation
+ } // defects4j.instrumentation
+ } // defects4j.instrumentation
+
+ public Complex add_original(Complex rhs) // defects4j.instrumentation
throws NullArgumentException {
MathUtils.checkNotNull(rhs);
return createComplex(real + rhs.getReal(),