Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100318

Re: Problem with sqlite3 and Decimal (fwd)

From "Frank Millman" <frank@chagford.com>
Newsgroups comp.lang.python
Subject Re: Problem with sqlite3 and Decimal (fwd)
Date 2015-12-12 07:22 +0200
Message-ID <mailman.169.1449897777.12405.python-list@python.org> (permalink)
References <201512111345.tBBDjgae025001@fido.openend.se> <CA+FnnTyaLLEsYGU7v2BreySDOQ1rVsMzJ=5f4iQTLW3=tn=E+Q@mail.gmail.com> <n4emgk$mrr$1@ger.gmane.org> <CA+FnnTyZY_1=62Rbk_kKZ39tkeoA6JVmFn9qs17aS-2YD4dVnA@mail.gmail.com>

Show all headers | View raw


"Igor Korot"  wrote in message 
news:CA+FnnTyZY_1=62Rbk_kKZ39tkeoA6JVmFn9qs17aS-2YD4dVnA@mail.gmail.com...
>
> Yes, I saw your post to sqlite3 ML.
> And I do know that by default sqlite3 does not have many types supported.
>
> However, all you need to do is save it as DECIMAL(10,2).
> It is supported is sqlite3 and it will have NUMERIC affinity (ref 1)
> or REAL (ref 2), which means the data will
> be stored as decimals and not a string.
>

Do you mean CREATE TABLE fmtemp (acno INT, balance DECIMAL(10,2));  ?

I tried that, but I got exactly the same result.

The answer, as explained by several people on the sqlite3 ML, is that 
sqlite3 does not have a true decimal type and therefore uses floating point 
internally. As we all know from many questions asked on this forum, floating 
point and exact decimal representation are incompatible.

Frank

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Problem with sqlite3 and Decimal (fwd) "Frank Millman" <frank@chagford.com> - 2015-12-12 07:22 +0200

csiph-web