Werner ;

In whatever language you use, how do you store a number?  How do you
display that number?  How do you take that set of bytes at a particular
memory location and get it to the users eyeballs?  You have to format it.
Your software converts that list of bytes into something human readable,
because, just looking at #3fc00000, I'd have NO clue what that means.

Any language I've used, if you have a float type, and output, just that raw
number, it'll output the minimal, formatted *human readable *number, unless
you use some kind of formatting routine.  var a:real;A:=1.50000;writeln(A);
--- Outputs 1.5.

SQLite stores any float/real/decimal number/integer as bytes in a row.  You
won't find "1.5" or "1.500" if you look at the SQLite file in a hex editor
unless you specifically stored it as text, but even then that might not be
true, because the DB engine might be intelligent enough to say "Hey!  This
is a number!  I'll store it as 4 bytes."  SQLite3, will quite literally in
that case, store the number as 4 bytes instead of 6-12 bytes for the
ASCII/UNICODE text version.

#3fc00000 is what 1.5 or 1.500 or 1.500000000000000000000000000 may look
like stored in the database. (That hex number grabbed from
https://www.h-schmidt.net/FloatConverter/IEEE754.html )

From *ANY* tool, what comes OUT of the database to your screen or printer
is a REPRESENTATION of what you want to see.  Its a User Interface thing.
Its making the number "Look Pretty".  Its 100% Aesthetic, for looks,
EXACTLY nothing more, and EXACTLY nothing less.

Whatever you are using, be it the MySQL client, or PHP, or Java, or QBASIC
or whatever you use, when you go and look at that number and that 'tool'
shows you that number, there are a LOT of things that are going on in the
background to show you what #3fc00000 is.  In MySQLs case, it apparently
looks at the definition of the column, sees that you've defined it as
something, then will PRESENT you with something that LOOKS like what it is
defined as.  It does NOT change how the number is stored, but just how you
want the output.  Its a superficial thing.

When you do calculations, say, 1.5*1.3, the computer is doing the float
math against 8 bytes, not "1.5" and "1.3".  (Float math breaks my brain,
like Pentiums F-Div bug)

On Fri, Dec 2, 2016 at 7:49 AM, Dominique Devienne <ddevie...@gmail.com>
wrote:

> On Fri, Dec 2, 2016 at 1:01 PM, Werner Kleiner <sqlitetes...@gmail.com>
> wrote:
>
> > @Darren,
> >
> > my "problem" is, that the both trailing zeros 00 after 1.5 are
> > missing in sqlite. In MySQL the price is stored as 1.500
> >
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to