/ Ticket Change Details
Login
Overview

Artifact ID: e97acd84dfb42d324b5de6f9af04cfcb52ac101dc85876e50a297e1caf98e3b7
Ticket: 3c27b97e319a263a607253b34270f4747ef8fac6
REAL rounding seems to depend on FROM clause
User & Date: mrigger 2019-05-16 17:52:14
Changes

  1. foundin changed to: "3.28"
  2. icomment:
    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); <br />
    CREATE TABLE t1 (c1 REAL); <br />
    
    INSERT INTO t1(c1) VALUES (8366271098608253588); <br />
    INSERT INTO t0(c0) VALUES ('a'); <br />
    
    SELECT * FROM t1 WHERE (t1.c1 = CAST(8366271098608253588 AS REAL)); -- fetches row <br />
    SELECT * FROM t0, t1 WHERE (t1.c1 = CAST(8366271098608253588 AS REAL)); -- fetches no row <br />
    SELECT * FROM t0, t1 WHERE (t1.c1 >= CAST(8366271098608253588 AS REAL) AND t1.c1 <= CAST(8366271098608253588 AS REAL)); -- fetches row
    
  3. login: "mrigger"
  4. mimetype: "text/x-fossil-wiki"
  5. severity changed to: "Critical"
  6. status changed to: "Open"
  7. title changed to: "REAL rounding seems to depend on FROM clause"
  8. type changed to: "Code_Defect"