Thought it was a little odd to have the "a=" in the select side and
not the where clause, but I see where you are going with this. The
real doesn't survive the roundtrip exactly unchanged, apparently,
though it looks like it does.

sqlite> select a, cast(a as text), cast(cast(a as text) as float) from t;
1.12589990684262e+15|1.12589990684262e+15|1.12589990684262e+15

sqlite> select typeof(a), typeof(cast(a as text)), typeof(cast(cast(a as text) a
s float)) from t;
real|text|real

sqlite> select * from t where a=cast(cast(a as text) as real);
(no rows)

sqlite> select * from t where cast(a as text)=cast(cast(a as text) as float);
1.12589990684262e+15

I don't know why that is, it's interesting.

-y




On Wed, Oct 5, 2011 at 10:34 AM, Wiktor Adamski
<bardzotajneko...@interia.pl> wrote:
> SQLite version 3.7.8 2011-09-19 14:49:19
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> create table t(a float);
> sqlite> insert into t values(1125899906842624);
> sqlite> select a = cast(cast(a as text) as float) from t;
> 0
>
> Yes, I know - 16 digits. But representable 16 digits. .dump also will
> export only 15 digits ant without any explicit casts precision will be
> lost after importing.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to