math module for Decimals

Mark Dickinson dickinsm at
Sun Jan 4 11:21:34 CET 2009

On Jan 4, 9:52 am, "alex goretoy" <aleksandr.gore... at> wrote:
> Also, another reason why I'm posting to this thread. I noticed some
> error/typo in line 683 of located on public svn repo. This is
> what is looks like.
>         sign = 0 if _math.copysign(1.0, f) == 1.0 else 1

This line looks okay to me; can you say why you think there's a typo

If it's the 'sign = 0' part that's bothering you, that's just
a peculiarity of Decimal: the stored sign value is 0 for
positive numbers, 1 for negative numbers, which I agree
is a little counterintuitive.  (Think of the sign
as analogous to the sign *bit* in an IEEE 754 floating-point


More information about the Python-list mailing list