REAL rounding seems to depend on FROM clause
|User & Date:||mrigger 2019-05-16 17:52:14|
- Change foundin to "3.28"
- Change icomment to:
It seems that depending on the FROM clause, a different floating-point rounding is performed as demonstrated in the example below. Although programmers should not compare floating-point numbers using equality operators, the result should not depend on the FROM clause either. It is not certain that this can be reproduced on all machines.
CREATE TABLE t0 (c0);
CREATE TABLE t1 (c1 REAL);
INSERT INTO t1(c1) VALUES (8366271098608253588);
INSERT INTO t0(c0) VALUES ('a');
SELECT * FROM t1 WHERE (t1.c1 = CAST(8366271098608253588 AS REAL)); -- fetches row
SELECT * FROM t0, t1 WHERE (t1.c1 = CAST(8366271098608253588 AS REAL)); -- fetches no row
SELECT * FROM t0, t1 WHERE (t1.c1 >= CAST(8366271098608253588 AS REAL) AND t1.c1 <= CAST(8366271098608253588 AS REAL)); -- fetches row
- Change login to "mrigger"
- Change mimetype to "text/x-fossil-wiki"
- Change severity to "Critical"
- Change status to "Open"
- Change title to "REAL rounding seems to depend on FROM clause"
- Change type to "Code_Defect"