Is signed zero always available?

Grant Edwards grant.b.edwards at gmail.com
Wed Jun 22 10:19:32 EDT 2016


On 2016-06-22, Steven D'Aprano <steve at pearwood.info> wrote:
> Both IEEE-754 floats and Decimals support signed zeroes, that is -0.0 and
> 0.0 are two distinct (but equal) values.
>
> (There is only one int zero: -0 and 0 are the same value.)

Is that guaranteed by Python, or just a side-effect of the
implementation?  Back in the days when Python used native C integers I
think the latter.  Now that Python implements it's own
arbitrary-length ints, it may be the former.

> Signed Decimal zero should always be available. What about signed float
> zero? Are there any platforms where Python is available that don't support
> signed zeroes?

-- 
Grant Edwards               grant.b.edwards        Yow! This ASEXUAL PIG
                                  at               really BOILS my BLOOD
                              gmail.com            ... He's so ... so
                                                   ... URGENT!!




More information about the Python-list mailing list