Hi there!
I hope you are well!

Recently I was working on project based on Android Sensors and encountered
a bug in sqlite db, situation was this:
I was setting there three values x,y,z as FLOAT, android inbuilt sensors
were receiving values as float upto 8 decimal places, but I wanted to store
value only upto 6 decimal place, so in android this is the way that first
you will have to convert that value into String , as* String sLongitude =
String.format("%.6f", x);*
*again I converted back to float this string formatted value, and printed
into Log, I was clearly seeing values upto 6 decimal places , but after
insertion into sqlite db, when after generation of sqlite db file, was
getting values upto 11-12 decimal places!*
*upto 6 decimal places were matching with my values and rest were garbage
values...*
*Then to avoid this I converted from FLOAT to VARCHAR into DB, and inserted
that formatted values  (**String sLongitude = String.format("%.6f", x)**)*
*now I was getting correct formatted values from sqlite db file,*

*I think this is a bug, this means float values in sqlite will always be
filled upto 11-12 decimal places, in any case, you will have to fill it, or
sqlite will fill it itself with junk values, **this may create lot of
consumption of memory while working on larger projects...*

*Thanks, waiting for a reply....*
*Abdul Aziz Ansari*
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to