[Python-Dev] Re: Decimal type question [Prothon] (original) (raw)
Paul Moore pf_moore at yahoo.co.uk
Mon Aug 9 20:31:33 CEST 2004
- Previous message: [Python-Dev] Re: Re: Decimal type question [Prothon]
- Next message: [Python-Dev] Re: Decimal type question [Prothon]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Mark Hahn <mark at prothon.org> writes:
Forgive me if I'm being a pest, but no one has commented on the real reason I asked the question. What does everyone think of the idea of having these three built-in numeric types?
1) An Int implemented with infinite precision integer (Python Longs) with the constant/str form of +-NN such as 0, -123, 173394, etc. 2) A Decimal implemented with the .Net decimal float (or the IBM decimal if the .Net decimal sucks too much) with the constant/str form of +-NN.NN such as 0.0, -123.0, 173394.0, 173394.912786765, etc. 3) A binary Float implemented with the hardware floating point with the constant/str form of +-NN.NN+-eNN such as 0e0, -123e0, 173.39e+3, 2.35e-78, etc. There would be no automatic conversion except the / operator would convert from Int to Decimal and the Math module would convert Int and Decimal values to Float for almost all functions (except simple ones like abs, min, max).
I think that having 2 different fractional types distinguished by something as subtle as the presence of an exponent (something no other language does to my knowledge) is an extremely bad idea.
Worse still is the fact that the exponent in the e notation is a decimal exponent, but the type used is binary!
Paul.
It is better to be quotable than to be honest -- Tom Stoppard
- Previous message: [Python-Dev] Re: Re: Decimal type question [Prothon]
- Next message: [Python-Dev] Re: Decimal type question [Prothon]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]