Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100317 > unrolled thread
| Started by | "Frank Millman" <frank@chagford.com> |
|---|---|
| First post | 2015-12-12 07:10 +0200 |
| Last post | 2015-12-12 07:10 +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.
Re: Problem with sqlite3 and Decimal "Frank Millman" <frank@chagford.com> - 2015-12-12 07:10 +0200
| From | "Frank Millman" <frank@chagford.com> |
|---|---|
| Date | 2015-12-12 07:10 +0200 |
| Subject | Re: Problem with sqlite3 and Decimal |
| Message-ID | <mailman.168.1449897031.12405.python-list@python.org> |
"Chris Angelico" wrote in message
news:CAPTjJmor6NewucCo7XTSSwyyfbgwCWZ8Jt-MjjkYSjOCFu78_A@mail.gmail.com...
On Fri, Dec 11, 2015 at 8:21 PM, Frank Millman <frank@chagford.com> wrote:
> > I noticed one oddity - I am asking sqlite3 to store the value as a
> > string,
> > but then I am asking it to perform arithmetic on it.
> It's an SQLite3 issue, not a Python one. I used the sqlite3
> stand-alone tool to do the same thing:
> sqlite> update fmtemp set bal = bal + cast('123.45' as numeric);
> sqlite> select bal from fmtemp;
> ...
> 5678.7
> 5802.15
> 5925.59999999999
>
You are right. I am still investigating alternatives, and will report back,
but here is a quick question.
I can reproduce your example above. However, if I set the initial value to
5678.7, then the sequence goes
5678.7
5802.15
5925.6
6049.05
6172.5
I would have thought that adding 123.45 to 5802.15 would always produce the
same result, but here it seems to depend on prior events.
Any idea why? Academic interest only, but I am curious.
Frank
Back to top | Article view | comp.lang.python
csiph-web