On 5/4/19, Manuel Rigger <rigger.man...@gmail.com> wrote:
> Hi everyone,
>
> Consider the following example:
>
> CREATE TABLE t1 (c0, c1 REAL, PRIMARY KEY (c1, c0));
> INSERT INTO t1(c1) VALUES (0X7ffffffffffffff);;
> SELECT ALL * FROM t1 WHERE c1 = 5.76460752303423e+17;
>
> I would expect the row to be fetched, which is not the case.

But 0x7ffffffffffffff != 5.76460752303423e+17.  Try it:

   SELECT 0x7ffffffffffffff != 5.76460752303423e+17;

You should get back 0.

The rule of thumb is to never expect the == operator to give a
meaningful answer for floating-point numbers.  Only use <, <=, >, and
>=.

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to