prePEP: Decimal data type

Batista, Facundo FBatista at uniFON.com.ar
Tue Nov 4 15:41:45 EST 2003


Tim Peters wrote:

#- [Facundo Batista]
#- > Are you sure? Because, for example with a precision of 9:
#- >
#- > 123 --> 123e0
#- > 1122334455667788 --> 112233445e7
#- >
#- > Meaning that you lost the last digits. We're talking about billions
#- > here, but an accounting person won't be happy with that.
#- 
#- Then they shouldn't use such a tiny precision; that's 
#- essentially IEEE
#- single precision.  Default to a precision of, say, 100, and 
#- you can count
#- the number of electrons in the universe exactly.  Since each 
#- penny contains
#- at least one electron ... <wink>.

Nice picture, :). But in Money you *want* to get rounded in the decimal
places.

Example of decimal with precision = 100:

1122334455667788  --> 1122334455667788
1122334455.667788 --> 1122334455.667788

But in Money, you may want to get rounded to two decimals:

1122334455.667788 --> 1122334455.67


#- > ...
#- > And I'm not quite sure that I understand what you mean 
#- with "unbounded
#- > precision" (that you can not say with fixed or floating 
#- point). Could
#- > you please explain that? thanks!
#- 
#- Unbounded precision ("to the left" of the radix point) is what my old
#- FixedPoint.py class did/does:  if you multiply two 
#- FixedPoint integers, the

So, unbounded precision and fixed point are the same? (I always assumed
that)

.	Facundo





More information about the Python-list mailing list