[Python-ideas] checking for identity before comparing built-in objects

Alexander Belopolsky alexander.belopolsky at gmail.com
Mon Oct 8 02:47:36 CEST 2012


Try this with Double instead of double.  Note that I said "*object*
equality".  In Java, lowercase double is not an object type.

On Sun, Oct 7, 2012 at 8:43 PM, Mike Graham <mikegraham at gmail.com> wrote:
> On Sun, Oct 7, 2012 at 8:35 PM, Alexander Belopolsky
> <alexander.belopolsky at gmail.com> wrote:
>> Java implements IEEE 754 to some extent, but preserves reflexivity of object equality.
>
> I don't actually know Java, but if I run
>
> class HelloNaN {
>     public static void main(String[] args) {
>         double nan1 = 0.0 / 0.0;
>         double nan2 = 0.0 / 0.0;
>         System.out.println(nan1 == nan2);
>     }
> }
>
> I get the output "false".
>
> Mike



More information about the Python-ideas mailing list