[squeak-dev] a==b "true" but a=b "false"

Andres Valloud avalloud at smalltalk.comcastbiz.net
Wed Sep 3 23:28:59 UTC 2014


IEEE-754 requires NaN != NaN.

On 9/3/14 16:11 , Chris Muller wrote:
> When could it happen?
>
> A:  With Float nan.
>
>     Float nan == Float nan   "true"
>
>     Float nan = Float nan   "false"
>
> It violates what I have long considered an invariant that if a==b, then a=b.
>
> Real world context:  When two DB clients change the same object in the
> exact same way, it's not a conflict.  If they change it differently,
> it is.
>
> They've both made the same reference to Float nan, but just asking if
> they made equivalent changes still reports false.  So I have to put in
> a complicated special check for NaN first..??
>
> Okay, I actually wrote:  (a==b or: [a=b]) but who would ever write
> that or not "simplify it" in teh future if they saw it?
>
> Comments?  Why shouldn't Float nan = Float nan?
>
>


More information about the Squeak-dev mailing list