Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11935
| References | <1e35ff5e-785e-41db-a50f-976e6ef60692@h9g2000vbr.googlegroups.com> <4e4ec962$0$29986$c3e8da3$5496439d@news.astraweb.com> <mailman.247.1313792673.27778.python-list@python.org> <4e4f1004$0$29966$c3e8da3$5496439d@news.astraweb.com> <9bb2ahFgjbU1@mid.individual.net> |
|---|---|
| Date | 2011-08-21 01:54 +0100 |
| Subject | Re: Replacement for the shelve module? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.274.1313888073.27778.python-list@python.org> (permalink) |
On Sun, Aug 21, 2011 at 1:37 AM, Gregory Ewing <greg.ewing@canterbury.ac.nz> wrote: > There's a certain accounting package I work with that *does* > use floats -- binary ones -- for accounting purposes, and > somehow manages to get away with it. Not something I would > recommend trying at home, though. > Probably quite a few, actually. It's not a very visible problem so long as you always have plenty of "spare precision", and you round everything off to two decimals (or however many for your currency). Eventually you'll start seeing weird results that are a cent off, but you won't notice them often. And hey. You store $1.23 as 1.23, and it just works! It must be the right thing to do! Me, I store dollars-and-cents currency in cents. Always. But that's because I never need fractional cents. I'm not sure what the best way to handle fractional cents is, but I'm fairly confident that this isn't it: http://thedailywtf.com/Articles/Price-in-Nonsense.aspx ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Replacement for the shelve module? Forafo San <ppv.grps@gmail.com> - 2011-08-19 08:31 -0700
Re: Replacement for the shelve module? Ken Watford <kwatford@gmail.com> - 2011-08-19 11:49 -0400
Re: Replacement for the shelve module? Thomas Jollans <t@jollybox.de> - 2011-08-19 17:54 +0200
Re: Replacement for the shelve module? Forafo San <ppv.grps@gmail.com> - 2011-08-19 09:21 -0700
Re: Replacement for the shelve module? Miki Tebeka <miki.tebeka@gmail.com> - 2011-08-19 10:15 -0700
Re: Replacement for the shelve module? Robert Kern <robert.kern@gmail.com> - 2011-08-19 12:45 -0500
Re: Replacement for the shelve module? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-20 06:36 +1000
Re: Replacement for the shelve module? Robert Kern <robert.kern@gmail.com> - 2011-08-19 17:24 -0500
Re: Replacement for the shelve module? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-20 11:38 +1000
Re: Replacement for the shelve module? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-08-21 12:37 +1200
Re: Replacement for the shelve module? Chris Angelico <rosuav@gmail.com> - 2011-08-21 01:54 +0100
csiph-web