acmp again !

forax at univ-mlv.fr forax at univ-mlv.fr
Thu Feb 21 14:01:04 UTC 2019


You mean the double comparison use doubleToLongBits, in that case, 
  value record Box(double value);

  new Box(0.0) == new Box(-1 * 0.0)  // false

which is not better.

Rémi

----- Mail original -----
> De: "Brian Goetz" <brian.goetz at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>, "John Rose" <john.r.rose at oracle.com>
> Cc: "valhalla-spec-experts" <valhalla-spec-experts at openjdk.java.net>
> Envoyé: Jeudi 21 Février 2019 14:33:06
> Objet: Re: acmp again !

>> NaN is interesting because it creates another corner case where the == will be
>> surprising if it's implemented has a component wise comparison,
>>    value record Box(double value);
>>
>>    var box = new Box(Double.NaN);
>>    box == box   // false
>>
>> so both semantics are not reflective.
> 
> Go re-read the definition of substitutibility, you'll see that indeed it
> is reflexive.  (Even though `==` on double is not.)   So you'll need to
> find another counterexample :)


More information about the valhalla-spec-observers mailing list