Discussions on floating point aside, I'm likewise getting results that are equal when trying it. So I'm curious as to the original poster's SQLite version, platform, language they're coding in, etc. When you run "select foo, typeof(foo) from test;" are you getting two results of (62.027393, 'real') or is one getting a real type and one getting a text type?
-----Original Message----- From: sqlite-users [mailto:[email protected]] On Behalf Of Quan Yong Zhai Sent: Monday, October 17, 2016 5:13 AM To: Keith Medcalf; SQLite mailing list Subject: Re: [sqlite] A possible double bug? I can’t reproduce the problem, http://sqlite.org/datatype3.html#type_affinity “When text data is inserted into a NUMERIC column, the storage class of the text is converted to INTEGER or REAL (in order of preference) if such conversion is lossless and reversible” So after “create table test (foo REAL)”. Foo field have “REAL” type affinity. INSERT INTO test VALUES(62.027393); or INSERT INTO test VALUES(“62.027393”); Or after prepare “ INSERT INTO test VALUES(?) “ Bind_text “62.027393” Bind_double 62.027393 In all the four situation, the value insert into foo field is binary identical, it’s a 8-bytes REAL value. #include <stdio.h> #include <sqlite3.h> int main() { sqlite3* db; sqlite3_stmt* stmt; sqlite3_open("double.sqlite", &db); sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS test(foo REAL);", 0, 0, 0); sqlite3_prepare(db, "INSERT INTO test VALUES(?)", -1, &stmt, 0); sqlite3_bind_text(stmt, 1, "62.027393", -1, SQLITE_STATIC); sqlite3_step(stmt); sqlite3_finalize(stmt); sqlite3_prepare(db, "INSERT INTO test VALUES(62.027393)", -1, &stmt, 0); sqlite3_step(stmt); sqlite3_finalize(stmt); sqlite3_close(db); } e:\Nana>sqlite3 double.sqlite sqlite> select typeof(foo) from test; real real sqlite> select * from test a cross join test b where a.foo=b.foo; 62.027393|62.027393 62.027393|62.027393 62.027393|62.027393 62.027393|62.027393 _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

