A quick experiment shows that 3.7.14 rounds off the last 2 digits of a 
double-precision.

As of 3.7.14 sqlite3 rounds to 15 significant digits when using the internal 
formatting routines.

sqlite3 test.db
SQLite version 3.7.14 2012-09-03 15:42:36
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table t(f real);
sqlite> insert into t values(1.7976931348623157e+308);
sqlite> select * from t;
1.79769313486232e+308

Full IEEE precision appears to be stored correctly for this value.
1.7976931348623157e+308 = 0x7FEFFFFFFFFFFFFF
http://babbage.cs.qc.cuny.edu/IEEE-754/
http://en.wikipedia.org/wiki/Double-precision_floating-point_format

od -x test.db | tail -n 2
0003760 0000 0000 010a 0702 ef7f ffff ffff ffff
0004000

Of course, if you print out this value yourself in your program you can get as 
many digits as you want.

As always many caveats apply to real precision....you have to be very careful 
with all sorts of things like lack of precision, rounding errors, etc.

Senior Scientist
Advanced Analytics Directorate
Advanced GEOINT Solutions Operating Unit
Northrop Grumman Information Systems

________________________________________
From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Baruch Burstein [bmburst...@gmail.com]
Sent: Tuesday, September 11, 2012 6:18 AM
To: General Discussion of SQLite Database
Subject: EXT :[sqlite] selecting real values

When selecting real (float) values, does the sqlite return (and the shell
display) the full precision it has by default, or does it have a higher
precision stored in the database than it displays?

--
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
_______________________________________________
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