>
>
> What do you mean, select precision? The double value you pass to
> sqlite3_bind_double() will be used as is. Are you saying you want to round
> it first? Then go ahead and do that - I'm not sure what that has to do with
> SQLite.
> --
>
It is an issue with SQLite because the values in NUMBER(10,2) have no
effect. Too often I see small values with 15 digits in a table because a
double was passed as-is. It is not just about space, it is also about
presentation. In engineering we are taught that the number of digits should
also tell you the accuracy of the sample, so for example a
latitude/longitude obtained from a handheld GPS should be stored with 6
decimal digits (~10cm), the rest is just junk. Since the database does not
do this for you, when the programmer knows the accuracy of the sample, he
shouldn't be lazy and instead do Round(Longitude*1000000)/1000000 before
binding. Of course, when the data is presented it should be properly
rounded with zeros added at the end or even zeros replacing digits to the
left of the decimal (to indicate precision), but my point is you shouldn't
store junk digits in the first place.

I love it that you don't have to specify TEXT and NUMBER lengths, but would
have preferred that SQLite didn't ignore them when specified and that in a
NUMBER(p,s) column, the double is stored as an integer internally if p<=18.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to