aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases
diff options
context:
space:
mode:
authorYegor Kozlov <yegor@apache.org>2010-10-01 12:02:52 +0000
committerYegor Kozlov <yegor@apache.org>2010-10-01 12:02:52 +0000
commitc27d3438ebd1fea4a02c86a9f346844e7cd6c6f3 (patch)
tree02bec6027d6ca182e33a4408d6e1cb2e0da8e22f /src/testcases
parent7033853c363379e86ce030a72c8bebc40b1ca5f9 (diff)
downloadpoi-c27d3438ebd1fea4a02c86a9f346844e7cd6c6f3.tar.gz
poi-c27d3438ebd1fea4a02c86a9f346844e7cd6c6f3.zip
improved rounding in MathX.mod, see Bugzilla 50033
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1003504 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases')
-rw-r--r--src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java b/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java
index 783294e9d3..a88f011e7b 100644
--- a/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java
+++ b/src/testcases/org/apache/poi/hssf/record/formula/functions/TestMathX.java
@@ -292,6 +292,20 @@ public class TestMathX extends AbstractNumericTestCase {
}
public void testMod() {
+
+ //example from Excel help
+ assertEquals(1.0, MathX.mod(3, 2));
+ assertEquals(1.0, MathX.mod(-3, 2));
+ assertEquals(-1.0, MathX.mod(3, -2));
+ assertEquals(-1.0, MathX.mod(-3, -2));
+
+ assertEquals((double) 1.4, MathX.mod(3.4, 2));
+ assertEquals((double) -1.4, MathX.mod(-3.4, -2));
+ assertEquals((double) 0.6000000000000001, MathX.mod(-3.4, 2.0));// should actually be 0.6
+ assertEquals((double) -0.6000000000000001, MathX.mod(3.4, -2.0));// should actually be -0.6
+
+ // Bugzilla 50033
+ assertEquals(1.0, MathX.mod(13, 12));
}
public void testNChooseK() {