<!-- Don't forget to update status.xml too! -->
<release version="3.5-beta6" date="2009-??-??">
+ <action dev="POI-DEVELOPERS" type="add">47198 - Fixed formula evaluator comparison of -0.0 and 0.0</action>
<action dev="POI-DEVELOPERS" type="add">47229 - Fixed ExternalNameRecord to handle DDE links</action>
<action dev="POI-DEVELOPERS" type="add">46287 - Control of header and footer extraction in ExcelExtractor / XSSFExcelExtractor</action>
<action dev="POI-DEVELOPERS" type="add">46554 - New ant target "jar-examples"</action>
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.5-beta6" date="2009-??-??">
+ <action dev="POI-DEVELOPERS" type="add">47198 - Fixed formula evaluator comparison of -0.0 and 0.0</action>
<action dev="POI-DEVELOPERS" type="add">47229 - Fixed ExternalNameRecord to handle DDE links</action>
<action dev="POI-DEVELOPERS" type="add">46287 - Control of header and footer extraction in ExcelExtractor / XSSFExcelExtractor</action>
<action dev="POI-DEVELOPERS" type="add">46554 - New ant target "jar-examples"</action>
if (vb instanceof NumberEval) {
NumberEval nA = (NumberEval) va;
NumberEval nB = (NumberEval) vb;
+ if (nA.getNumberValue() == nB.getNumberValue()) {
+ // Excel considers -0.0 == 0.0 which is different to Double.compare()
+ return 0;
+ }
return Double.compare(nA.getNumberValue(), nB.getNumberValue());
}
}
BoolEval be = (BoolEval) result;
return be.getBooleanValue();
}
+
+ /**
+ * Excel considers -0.0 to be equal to 0.0
+ */
+ public void testZeroEquality_bug47198() {
+ NumberEval zero = new NumberEval(0.0);
+ NumberEval mZero = (NumberEval) UnaryMinusEval.instance.evaluate(new Eval[] { zero, }, 0,
+ (short) 0);
+ Eval[] args = { zero, mZero, };
+ BoolEval result = (BoolEval) EqualEval.instance.evaluate(args, 0, (short) 0);
+ if (!result.getBooleanValue()) {
+ throw new AssertionFailedError("Identified bug 47198: -0.0 != 0.0");
+ }
+ }
}