On 7 Feb 2015, at 2:22pm, Abdul Aziz <abduldblog...@gmail.com> wrote:

> but in fields which were FLOAT were
> filling with junk values (after 6 decimal places, see in SENSOR_1) why?

Take a look at what happens when you try to write 1/13th in decimal:

0.076923076923076923076923076923076923076923076923076923.....

What about 7/9ths:

0.777777777777777777777777777777777777777777777777777777.....

And PI:

3.1415926535897932384626443323279502..... (I forget the rest)

There's no way to write those numbers precisely in decimal.  The first repeats 
after the sixth place.  The second repeats after the first place.  The third 
never repeats, but also never stops.  Similarly there's no way to write some 
numbers precisely in binary.  So if I tell you you had to write the number 
using just digits and a decimal point, you can't do it.  Similarly, if you 
convert some numbers into binary format and back (just 0 and 1 and a decimal 
point) you don't get back precisely the number you put in.

Fields defined as FLOAT (in your Android API) have their values stored in 
binary format.  So storing a number in that field involves converting it to 
binary.  If, instead, you define your fields as text no conversion takes place 
because there's no need to turn the number into binary format.

(Above explanation simplified with respect to affinities and deep maths for 
simplicity.)

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to