[issue4024] float(0.0) singleton

lplatypus report at bugs.python.org
Fri Oct 3 14:00:02 CEST 2008


lplatypus <luke at deller.id.au> added the comment:

No it won't distinguish between +0.0 and -0.0 in its present form,
because these two have the same value according to the C equality
operator.  This should be easy to adjust, eg we could exclude -0.0 by
changing the comparison
    if (fval == 0.0)
into 
    static double positive_zero = 0.0;
    ...
    if (!memcmp(&fval, &positive_zero, sizeof(double)))

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4024>
_______________________________________


More information about the Python-bugs-list mailing list