diff options
Diffstat (limited to 'libjava/classpath/gnu/xml/xpath/ArithmeticExpr.java')
-rw-r--r-- | libjava/classpath/gnu/xml/xpath/ArithmeticExpr.java | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/libjava/classpath/gnu/xml/xpath/ArithmeticExpr.java b/libjava/classpath/gnu/xml/xpath/ArithmeticExpr.java index 3cef4adf3cc..cbc1ee0648b 100644 --- a/libjava/classpath/gnu/xml/xpath/ArithmeticExpr.java +++ b/libjava/classpath/gnu/xml/xpath/ArithmeticExpr.java @@ -95,17 +95,31 @@ final class ArithmeticExpr case DIVIDE: if (rn == 0.0d || rn == -0.0d) { - return new Double(ln < 0.0d ? - Double.NEGATIVE_INFINITY : - Double.POSITIVE_INFINITY); + if (ln == 0.0d || ln == -0.0d) + { + return new Double(Double.NaN); + } + else + { + return new Double(ln < 0.0d ? + Double.NEGATIVE_INFINITY : + Double.POSITIVE_INFINITY); + } } return new Double(ln / rn); case MODULO: - if (rn == 0.0d || rn == -0.0d) + if (rn == 0.0d || rn == 0.0d) { - return new Double(ln < 0.0d ? - Double.NEGATIVE_INFINITY : - Double.POSITIVE_INFINITY); + if (ln == 0.0d || ln == -0.0d) + { + return new Double(Double.NaN); + } + else + { + return new Double(ln < 0.0d ? + Double.NEGATIVE_INFINITY : + Double.POSITIVE_INFINITY); + } } return new Double(ln % rn); default: |