[Python-Dev] Decimal data type issues

Aahz aahz at pythoncraft.com
Wed Apr 14 10:42:26 EDT 2004


On Tue, Apr 13, 2004, Ka-Ping Yee wrote:
>
> So here's a more detailed suggestion.  Suppose s = '12345', f = 12.345,
> the default context specifies a precision of 9 as given in the PEP, and
> c is a context object with a precision of 6.
> 
> Then this:                      would yield this:
>
> Decimal(f)                      Decimal((0, (1, 2, 3, 4, 5, 0, 0, 0, 0, 0,
>                                              0, 0, 0, 0, 0, 0, 0, 6, 3, 9,
>                                              4, 8, 8, 4, 6, 2, 1, 8, 4, 0,
>                                              9, 0, 1, 6, 7, 2, 8, 4, 0, 1,
>                                              1, 8, 4, 0, 8, 2, 0, 3, 1, 2,
>                                              5), -49))

I'll continue to oppose allowing Decimal() to take a float argument.
It's just asking for trouble.  Re-read the previous thread about repr()
of floats if you want to argue with me; I shan't say anything new.  ;-)
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Why is this newsgroup different from all other newsgroups?



More information about the Python-Dev mailing list