Re: Decimal data type issues
[Kevin Jacobs] #- Decimal('2.4000', precision=2, scale=1) == Decimal('2.4') #- Decimal('2.4', precision=5, scale=4) == Decimal('2.4000') #- #- Remember, these literals are frequently coming from an #- external source that must be constrained to a given schema. Facundo
I like it a lot, but not for Decimal.
This is another face of "what do do with float" Just because your default context has n digits of precision doesn't mean that all your input will. If my input has 2.4000 (but the extra zeros were measured) then I want to keep that information. If my input has 2.4 (and I didn't measure beyond those digits) I want to know that for error analysis. If my input has 1.1 (only measured to two digits) but my context is 25, I don't want to assume that the machine's float-rounding is correct; the fairest "I don't know" estimate is still zero, even out to digit 100. -jJ
On Mon, Apr 19, 2004, Jewett, Jim J wrote:
[Kevin Jacobs] #- Decimal('2.4000', precision=2, scale=1) == Decimal('2.4') #- Decimal('2.4', precision=5, scale=4) == Decimal('2.4000') #- #- Remember, these literals are frequently coming from an #- external source that must be constrained to a given schema.
Facundo
I like it a lot, but not for Decimal.
This is another face of "what do do with float"
This has nothing to do with binary floating point. These are strings that map to exact numbers in Decimal; if you want to do something different with them, it's your responsibility as a programmer. Decimal should provide a solid foundation, not every bell & whistle. If you disagree, go read Cowlishaw first. -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ "I used to have a .sig but I found it impossible to please everyone..." --SFJ
participants (2)
-
Aahz
-
Jewett, Jim J