From 4a0b43caadb21ed2bf5a6c6ee7622ac5b734f58b Mon Sep 17 00:00:00 2001 From: shaneh Date: Tue, 16 Feb 2010 22:00:35 +0000 Subject: [PATCH] Added additional rounding tests. FossilOrigin-Name: b8ee76bc1fd355110149bd9135dd31a5724c2ac6 --- manifest | 14 ++++----- manifest.uuid | 2 +- test/func.test | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 948de7d862..f1a5dde15d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Change\sa\sC++\sstyle\scomment\sin\sos_unix.c\sto\suse\snormal\sC\sstyle\scommenting. -D 2010-02-16T12:18:48 +C Added\sadditional\srounding\stests. +D 2010-02-16T22:00:36 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -408,7 +408,7 @@ F test/fts3query.test 154fe4b015fd61af523ee083570a134f508f5be7 F test/fts3rnd.test 2f5761db9dd92f6fe09d08976ac658ef521846ed F test/fts3snippet.test 5745ce7270fb754b4f998c6bc33bf843791f6e36 F test/fts4aa.test 9a9bc506487399c17284fa82a72f16d5ced2910c -F test/func.test af106ed834001738246d276659406823e35cde7b +F test/func.test c12663a99d9ad96737b6a3efd65e0d2d436ff4ab F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f F test/fuzz.test a4174c3009a3e2c2e14b31b364ebf7ddb49de2c9 F test/fuzz2.test 207d0f9d06db3eaf47a6b7bfc835b8e2fc397167 @@ -788,7 +788,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P ebc9433fddf78ef7b4237686951d8d79c1c98f03 -R b5dfe1f1114f3d23dae72982ad21694f -U dan -Z cf26dc12bf459704264dda128f7767fa +P 7a1933097f2a95bd495c1621fca99e8952a1b25a +R ca399e3d0f2d6f8be8f0f4b20e5d3fb6 +U shaneh +Z b58ba50cfe1c773cd5719e055e92f490 diff --git a/manifest.uuid b/manifest.uuid index d566b45fa9..e62bc2eea5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7a1933097f2a95bd495c1621fca99e8952a1b25a \ No newline at end of file +b8ee76bc1fd355110149bd9135dd31a5724c2ac6 \ No newline at end of file diff --git a/test/func.test b/test/func.test index 91ae0a5925..ccdda0cd8a 100644 --- a/test/func.test +++ b/test/func.test @@ -235,6 +235,84 @@ ifcapable floatingpoint { do_test func-4.16 { catchsql {SELECT round(b,2.0) FROM t1 ORDER BY b} } {0 {-2.0 1.23 2.0}} + # Verify some values reported on the mailing list. + # Some of these fail on MSVC builds with 64-bit + # long doubles, but not on GCC builds with 80-bit + # long doubles. + for {set i 1} {$i<999} {incr i} { + set x1 [expr 40222.0 + $i + 0.5] + set x2 [expr 40223.0 + $i] + do_test func-4.17.$i { + execsql {SELECT round($x1);} + } $x2 + } + do_test func-4.18 { + execsql {SELECT round(41051.5);} + } {41052.0} + do_test func-4.19 { + execsql {SELECT round(41224.5);} + } {41225.0} + do_test func-4.20 { + execsql {SELECT round(40223.4999999999);} + } {40223.0} + do_test func-4.21 { + execsql {SELECT round(40224.4999999999);} + } {40224.0} + do_test func-4.22 { + execsql {SELECT round(40225.4999999999);} + } {40225.0} + for {set i 1} {$i<10} {incr i} { + do_test func-4.23.$i { + execsql {SELECT round(40223.4999999999,$i);} + } {40223.5} + do_test func-4.24.$i { + execsql {SELECT round(40224.4999999999,$i);} + } {40224.5} + do_test func-4.25.$i { + execsql {SELECT round(40225.4999999999,$i);} + } {40225.5} + } + for {set i 10} {$i<32} {incr i} { + do_test func-4.26.$i { + execsql {SELECT round(40223.4999999999,$i);} + } {40223.4999999999} + do_test func-4.27.$i { + execsql {SELECT round(40224.4999999999,$i);} + } {40224.4999999999} + do_test func-4.28.$i { + execsql {SELECT round(40225.4999999999,$i);} + } {40225.4999999999} + } + do_test func-4.29 { + execsql {SELECT round(1234567890.5);} + } {1234567891.0} + do_test func-4.30 { + execsql {SELECT round(12345678901.5);} + } {12345678902.0} + do_test func-4.31 { + execsql {SELECT round(123456789012.5);} + } {123456789013.0} + do_test func-4.32 { + execsql {SELECT round(1234567890123.5);} + } {1234567890124.0} + do_test func-4.33 { + execsql {SELECT round(12345678901234.5);} + } {12345678901235.0} + do_test func-4.34 { + execsql {SELECT round(1234567890123.35,1);} + } {1234567890123.4} + do_test func-4.35 { + execsql {SELECT round(1234567890123.445,2);} + } {1234567890123.45} + do_test func-4.36 { + execsql {SELECT round(99999999999994.5);} + } {99999999999995.0} + do_test func-4.37 { + execsql {SELECT round(9999999999999.55,1);} + } {9999999999999.6} + do_test func-4.38 { + execsql {SELECT round(9999999999999.555,2);} + } {9999999999999.56} } # Test the upper() and lower() functions