Dr. Richard Hipp, on Friday, May 24, 2019 01:06 PM, wrote...
>
>I also went to sqlfiddle and did a slightly more realistic scenario:
>
>  CREATE TABLE t1(a INT, b DOUBLE PRECISION);
>  INSERT INTO t1(a,b) VALUES(1,3.255);
>  INSERT INTO t1(a,b) VALUES(2,3.254999999999999893418589635);
>  SELECT a, b FROM t1;
>
>In other words, I made the value actually pass through the database.
Good call...

>For MySQL I got:
>
>    1 3.26
>    2 3.26
>
>For SQL Server I got:
>
>    1 3.25
>    2 3.25
>
>The query does not work on PostgreSQL, because PG wisely prohibits
>using the two-argument around() function on binary floating-point
>values, perhaps to prevent discussions such as this one.  In order to
>get this to work on PG I had to modify the query as follows:
>
>   SELECT a, round(CAST(b AS NUMERIC),2) from t1
>
>And the result is then:
>
>    1 3.26
>    2 3.26

Touché!

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

Reply via email to