1-- float8 check 2CREATE TABLE float8tmp (a float8); 3\copy float8tmp from 'data/float8.data' 4SET enable_seqscan=on; 5SELECT count(*) FROM float8tmp WHERE a < -1890.0; 6 count 7------- 8 237 9(1 row) 10 11SELECT count(*) FROM float8tmp WHERE a <= -1890.0; 12 count 13------- 14 238 15(1 row) 16 17SELECT count(*) FROM float8tmp WHERE a = -1890.0; 18 count 19------- 20 1 21(1 row) 22 23SELECT count(*) FROM float8tmp WHERE a >= -1890.0; 24 count 25------- 26 307 27(1 row) 28 29SELECT count(*) FROM float8tmp WHERE a > -1890.0; 30 count 31------- 32 306 33(1 row) 34 35SELECT a, a <-> '-1890.0' FROM float8tmp ORDER BY a <-> '-1890.0' LIMIT 3; 36 a | ?column? 37--------------+-------------------- 38 -1890 | 0 39 -2003.634512 | 113.63451200000009 40 -1769.73634 | 120.26366000000007 41(3 rows) 42 43CREATE INDEX float8idx ON float8tmp USING gist ( a ); 44SET enable_seqscan=off; 45SELECT count(*) FROM float8tmp WHERE a < -1890.0::float8; 46 count 47------- 48 237 49(1 row) 50 51SELECT count(*) FROM float8tmp WHERE a <= -1890.0::float8; 52 count 53------- 54 238 55(1 row) 56 57SELECT count(*) FROM float8tmp WHERE a = -1890.0::float8; 58 count 59------- 60 1 61(1 row) 62 63SELECT count(*) FROM float8tmp WHERE a >= -1890.0::float8; 64 count 65------- 66 307 67(1 row) 68 69SELECT count(*) FROM float8tmp WHERE a > -1890.0::float8; 70 count 71------- 72 306 73(1 row) 74 75EXPLAIN (COSTS OFF) 76SELECT a, a <-> '-1890.0' FROM float8tmp ORDER BY a <-> '-1890.0' LIMIT 3; 77 QUERY PLAN 78----------------------------------------------------- 79 Limit 80 -> Index Only Scan using float8idx on float8tmp 81 Order By: (a <-> '-1890'::double precision) 82(3 rows) 83 84SELECT a, a <-> '-1890.0' FROM float8tmp ORDER BY a <-> '-1890.0' LIMIT 3; 85 a | ?column? 86--------------+-------------------- 87 -1890 | 0 88 -2003.634512 | 113.63451200000009 89 -1769.73634 | 120.26366000000007 90(3 rows) 91 92