You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2015/05/04 21:16:34 UTC
[math] Added debug traces for investigating H10 builds failures.
Repository: commons-math
Updated Branches:
refs/heads/h10-builds [created] 0d0f8e830
Added debug traces for investigating H10 builds failures.
Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/0d0f8e83
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/0d0f8e83
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/0d0f8e83
Branch: refs/heads/h10-builds
Commit: 0d0f8e830a383863953976effd05e75f01e596b1
Parents: 6571233
Author: Luc Maisonobe <lu...@apache.org>
Authored: Mon May 4 21:15:10 2015 +0200
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Mon May 4 21:15:10 2015 +0200
----------------------------------------------------------------------
.../org/apache/commons/math4/util/FastMath.java | 18 ++++++++++++++++++
.../apache/commons/math4/util/FastMathTest.java | 5 +++++
2 files changed, 23 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-math/blob/0d0f8e83/src/main/java/org/apache/commons/math4/util/FastMath.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/FastMath.java b/src/main/java/org/apache/commons/math4/util/FastMath.java
index 24bb857..59cd2d8 100644
--- a/src/main/java/org/apache/commons/math4/util/FastMath.java
+++ b/src/main/java/org/apache/commons/math4/util/FastMath.java
@@ -1469,8 +1469,12 @@ public class FastMath {
}
if (x == 0) {
+ System.out.format(java.util.Locale.US, "in if (x == 0)%nx = %x, %22.19f, y = %x, %22.19f%n",
+ Double.doubleToRawLongBits(x), x,
+ Double.doubleToRawLongBits(y), y);
long bits = Double.doubleToRawLongBits(x);
if ((bits & 0x8000000000000000L) != 0) {
+ System.out.format(java.util.Locale.US, "in if ((bits & 0x8000000000000000L) != 0)%n");
// -zero
long yi = (long) y;
@@ -1484,6 +1488,7 @@ public class FastMath {
}
if (y < 0) {
+ System.out.format(java.util.Locale.US, "in if (y < 0)%n");
return Double.POSITIVE_INFINITY;
}
if (y > 0) {
@@ -1505,13 +1510,26 @@ public class FastMath {
}
if (y == Double.POSITIVE_INFINITY) {
+ System.out.format(java.util.Locale.US, "in if (y == Double.POSITIVE_INFINITY)%n");
+ System.out.format(java.util.Locale.US, "x = %x, %22.19f, y = %x, %22.19f%n",
+ Double.doubleToRawLongBits(x), x,
+ Double.doubleToRawLongBits(y), y);
if (x * x == 1.0) {
+ System.out.format(java.util.Locale.US, "in if(x * x == 1.0) --> return NaN%n",
+ Double.doubleToRawLongBits(x), x,
+ Double.doubleToRawLongBits(y), y);
return Double.NaN;
}
if (x * x > 1.0) {
+ System.out.format(java.util.Locale.US, "in if(x * x > 1.0) --> return positive infinity%n",
+ Double.doubleToRawLongBits(x), x,
+ Double.doubleToRawLongBits(y), y);
return Double.POSITIVE_INFINITY;
} else {
+ System.out.format(java.util.Locale.US, "in else (i.e. not x * x > 1.0) --> return 0.0%n",
+ Double.doubleToRawLongBits(x), x,
+ Double.doubleToRawLongBits(y), y);
return 0.0;
}
}
http://git-wip-us.apache.org/repos/asf/commons-math/blob/0d0f8e83/src/test/java/org/apache/commons/math4/util/FastMathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/FastMathTest.java b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
index 5d36fea..f97ad99 100644
--- a/src/test/java/org/apache/commons/math4/util/FastMathTest.java
+++ b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
@@ -52,6 +52,11 @@ public class FastMathTest {
}
@Test
+ public void testH10() {
+ Assert.assertEquals(0.0, FastMath.pow(-0.0, Double.POSITIVE_INFINITY), 1.0e-15);
+ }
+
+ @Test
public void testMinMaxDouble() {
double[][] pairs = {
{ -50.0, 50.0 },