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


Groups > comp.lang.python > #100318 > unrolled thread

Re: Problem with sqlite3 and Decimal (fwd)

Started by"Frank Millman" <frank@chagford.com>
First post2015-12-12 07:22 +0200
Last post2015-12-12 07:22 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#100318 — Re: Problem with sqlite3 and Decimal (fwd)

From"Frank Millman" <frank@chagford.com>
Date2015-12-12 07:22 +0200
SubjectRe: Problem with sqlite3 and Decimal (fwd)
Message-ID<mailman.169.1449897777.12405.python-list@python.org>
"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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web