summaryrefslogtreecommitdiff
path: root/mysql-test/r/func_math.result
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@sun.com>2009-02-23 14:28:26 +0200
committerAlexey Kopytov <Alexey.Kopytov@sun.com>2009-02-23 14:28:26 +0200
commit0e62c9aa6301de71164496ec7c81c871d78ce8cd (patch)
treec507314a3bdbff4f5bf5079cdf4b16a6899bb25a /mysql-test/r/func_math.result
parentddf6ac40ea0f3290c148b3009069a22f12ab6e70 (diff)
downloadmariadb-git-0e62c9aa6301de71164496ec7c81c871d78ce8cd.tar.gz
Fix for bug #15936: "round" differs on Windows to Unix
Both of our own implementations of rint(3) were inconsistent with the most common behavior of rint() on those platforms that have it: round to nearest, break ties by rounding to nearest even. Fixed by leaving just one implementation of rint() in our source tree, and changing its behavior to match the most common native implementations on other platforms. configure.in: Added checks for fenv.h and fesetround(). include/config-win.h: Removed the incorrect implementation of rint() for Windows. include/my_global.h: Added an rint() implementation for platforms that do not have it. mysql-test/r/func_math.result: Added a test case for bug #15936. mysql-test/t/func_math.test: Added a test case for bug #15936. sql/mysqld.cc: Explicitly set the FPU rounding mode with fesetround().
Diffstat (limited to 'mysql-test/r/func_math.result')
-rw-r--r--mysql-test/r/func_math.result30
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 0d7adbbba5e..87cfb5b86a5 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -360,4 +360,34 @@ SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
a DIV 2
0
DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE);
+INSERT INTO t1 VALUES (-1.1), (1.1),
+(-1.5), (1.5),
+(-1.9), (1.9),
+(-2.1), (2.1),
+(-2.5), (2.5),
+(-2.9), (2.9),
+# Check numbers with absolute values > 2^53 - 1
+# (see comments for MAX_EXACT_INTEGER)
+(-1e16 - 0.5), (1e16 + 0.5),
+(-1e16 - 1.5), (1e16 + 1.5);
+SELECT a, ROUND(a) FROM t1;
+a ROUND(a)
+-1.1 -1
+1.1 1
+-1.5 -2
+1.5 2
+-1.9 -2
+1.9 2
+-2.1 -2
+2.1 2
+-2.5 -2
+2.5 2
+-2.9 -3
+2.9 3
+-1e+16 -10000000000000000
+1e+16 10000000000000000
+-1e+16 -10000000000000002
+1e+16 10000000000000002
+DROP TABLE t1;
End of 5.0 tests