osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why float('Nan') == float('Nan') is False


On 2019-02-13, ast <none at gmail.com> wrote:
> Hello
>
> >>> float('Nan') == float('Nan')
> False

If you think that's odd, how about this?

    >>> n = float('nan')
    >>> n
    nan
    >>> n is n
    True
    >>> n == n
    False
    >>>

> Why ?

IEEE says so.

-- 
Grant Edwards               grant.b.edwards        Yow! Like I always say
                                  at               -- nothing can beat
                              gmail.com            the BRATWURST here in
                                                   DUSSELDORF!!