prePEP: Decimal data type
FBatista at uniFON.com.ar
Tue Nov 4 18:34:28 CET 2003
John Roth wrote:
#- Why is ANSI 274 significant? The reason I ask this is that this is
#- a ***floating point*** standard, and I don't think that we
#- care for decimal floating point.
#- Floating point presumes limited precision. In other words,
#- if the actual
#- number (exclusive of the location of the decimal point) gets
#- too large,
#- the least significant part is ... thrown away. I don't want that.
If what you're saying is that, with a precision of 5...
45 --> 00045E+0
45321 --> 45321E+0
453211 --> 45321E+1
You may not like it, but that what it is: I'm following the General Decimal
Arithmetic Specification, see Mike Cowlishaw's work at
#- The "other type" should be handled in the same way the decimal()
#- constructor would handle it.
¿Are you saying that if Decimal('45') is valid, Decimal('45') + '25' should
also be valid? Mmm... ugly, ugly.
#- > 1. The syntax should be ``Decimal(value)``.
#- Lower case: "decimal(value, [scale factor])"
I thought that first letter in uppercase was good style for class names.
#- > 4. The Context must be omnipresent, meaning that changes
#- to it affects all
#- > the current and future Decimal instances.
#- No. The context should be selectable for the particular
#- usage. That is,
#- it should be possible to have several different contexts in
#- play at one
#- time in an application.
The concept of context is a "configuration place" surrounding the instances.
What you propose?
- the configuration (precision, flags, etc) is on by-instance basis
- you have different contexts, and a group of instances with each
#- > 9. To have different kinds of rounding; you can choose the
#- > context:
#- > ...
#- I think this is simply too much. I'd rather have a round()
#- method that
#- takes a *small* number of standard options, and otherwise takes a
#- function to do the rounding.
Again, this is the General Decimal Arithmetic Specification.
More information about the Python-list