From 9a489f1f09e069d9ca1a38efa0c3aba851a8d412 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 7 Mar 2017 13:17:08 +0100 Subject: [PATCH] fixed files form Math #54 --- projects/Math/54/org/apache/commons/math/dfp/Dfp.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/Math/54/org/apache/commons/math/dfp/Dfp.java b/projects/Math/54/org/apache/commons/math/dfp/Dfp.java index 73f1ea3..54aabc4 100644 --- a/projects/Math/54/org/apache/commons/math/dfp/Dfp.java +++ b/projects/Math/54/org/apache/commons/math/dfp/Dfp.java @@ -270,6 +270,9 @@ protected Dfp(final DfpField field, double x) { // Zero or sub-normal if (x == 0) { // make sure 0 has the right sign + if ((bits & 0x8000000000000000L) != 0) { + sign = -1; + } return; } @@ -2316,7 +2319,10 @@ public double toDouble() { Dfp y = this; boolean negate = false; - if (lessThan(getZero())) { + int cmp0 = compare(this, getZero()); + if (cmp0 == 0) { + return sign < 0 ? -0.0 : +0.0; + } else if (cmp0 < 0) { y = negate(); negate = true; }