/ Check-in [1d642b73]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Some simple test cases from the mailing list.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | int-float-precision
Files: files | file ages | folders
SHA1: 1d642b73f9e93a1ba291bf265b3d17e46551d70e
User & Date: drh 2015-11-06 03:37:02
Context
2015-11-06
04:14
More test cases for indexes on large numeric values. check-in: c220741a user: drh tags: int-float-precision
03:37
Some simple test cases from the mailing list. check-in: 1d642b73 user: drh tags: int-float-precision
01:04
Increase the precision of integer vs. floating-point comparisons. Candidate fix for ticket [38a97a87a6e4e8]. check-in: cfcaa0ff user: drh tags: int-float-precision
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added test/numindex1.test.























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 2015-11-05
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements tests for indexes on large numeric values.
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl


# Test cases from Zsbán Ambrus:
#
do_execsql_test numindex1-1.1 {
  CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
  CREATE INDEX t1b ON t1(b);
  INSERT INTO t1(a,b) VALUES(100, 356282677878746339);
  INSERT INTO t1(a,b) VALUES(50, 356282677878746339.0);
  INSERT INTO t1(a,b) VALUES(0, 356282677878746340);
  DELETE FROM t1 WHERE a=50;
  PRAGMA integrity_check;
} {ok}

do_execsql_test numindex1-1.2 {
  CREATE TABLE t2(a,b);
  INSERT INTO t2(a,b) VALUES('b', 1<<58),
      ('c', (1<<58)+1e-7), ('d', (1<<58)+1);
  SELECT a, b, typeof(b), '|' FROM t2 ORDER BY +a;
} {b 288230376151711744 integer | c 2.88230376151712e+17 real | d 288230376151711745 integer |}

do_execsql_test numindex1-1.3 {
  SELECT x.a || CASE WHEN x.b==y.b THEN '==' ELSE '<>' END || y.a
    FROM t2 AS x, t2 AS y
   ORDER BY +x.a, +x.b;
} {b==b b==c b<>d c==b c==c c<>d d<>b d<>c d==d}

finish_test