[Python-ideas] Changing Decimal.__pos__ and Decimal.__neg__ [Was: Re: Python Numbers as Human Concept Decimal System]
Mark Dickinson
dickinsm at gmail.com
Mon Mar 10 20:30:49 CET 2014
On Mon, Mar 10, 2014 at 7:08 PM, Tim Peters <tim.peters at gmail.com> wrote:
> Looks like Mike C's intent was that
>
> +x
>
> act like
>
> Decimal(0) + x
> [...]
Yes, I'm pretty sure that's what he intended. It's clearly spelled out in
the standard: "the operations plus(a) and minus(a) (where a and b refer to
any numbers) are calculated as the operations add(’0’, a) and subtract(’0’,
b)respectively", but not in our docs.
Can't win! That -x loses the sign when x is a positive 0 (under most
> rounding modes) is jarring; but that the results of "-x" and "0-x" may
> not be the same would also be jarring.
>
Hmm. I find the second option a lot less jarring than the first, but maybe
that's because I'm used to it (and because I'm too young to really remember
non-IEEE floating-point formats; the only one I really encountered was the
Sinclair ZX81's 40-bit format).
Not a fan of signed zeroes :-(
>
Yeah, me neither, but with IEEE 754 world domination it looks like they're
here to stay.
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140310/26f2442a/attachment-0001.html>
More information about the Python-ideas
mailing list