prePEP: Decimal data type

Batista, Facundo FBatista at uniFON.com.ar
Tue Nov 4 13:08:36 EST 2003


Alex Martelli wrote:

#- The Decimal type discussed in this PEP is the arithmetic fundament
#- for Money.  Facundo started out with the idea of a PEP for a type
#- named Money that mixed arithmetic, parsing and formatting concerns.

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.

I think that for Money with need a Fixed Point Decimal, but that's a whole
new problem.


#- He received ample and detailed feedback, on the basis of which he
#- (quite reasonably, IMHO) concluded that a Decimal type, based on
#- existing nondist/sandbox implementations that realized Cowlishaw's
#- ideas and work (as per the first URL above) would be the right
#- fundament for a Money type (which could either subclass or use it
#- and add parsing and formatting niceties as needed).

I thought Decimal was the answer for Money, but now I'm not so sure. In the
meantime, I read the code and the specification and commited myself to make
the PEP.


#- So, this Decimal type isn't "duplicating" anything: it's intended
#- to _supply_ the arithmetic features needed (inter alia) by money
#- computations.

Is still right that we're not duplicating efforts. If this will be the base
for Money, I don't know. But I'm sure it'll be useful for doing decimal
math.


#- > I can see some justification for a simple, straightforward,
#- > fixed decimal type that makes reasonable assumptions in
#- > corner cases, while still allowing the programmer a good
#- > deal of control if she wants to exercise it.
#- 
#- I do not think Decimal is limited to either fixed or floating
#- point.  The Hursley site is quite specific in claiming that
#- both can be supported in a single underlying type.  Unbounded
#- precision is a different issue.

Didn't found that. 

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!

.	Facundo








More information about the Python-list mailing list