hpi-swa / RSqueak

A Squeak/Smalltalk VM written in RPython.
BSD 3-Clause "New" or "Revised" License
83 stars 15 forks source link

Float class>>nan broken #86

Closed matthias-springer closed 9 years ago

matthias-springer commented 9 years ago

In Squeak: Float nan = Float nan is false and Float nan == Float nan is true. In RSqueak: both are false

j4yk commented 9 years ago

Is it reasonable to state something is identical but not equal?

matthias-springer commented 9 years ago

Not sure about semantics here, but just found out that x != x in Python if x = float('nan') (what???).

krono commented 9 years ago

Thats perfectly ok. Holds in Smalltalk and also Ruby:

irb(main):002:0> x = 0 / 0.0
=> NaN
irb(main):003:0> x == x
=> false
irb(main):004:0> 
matthias-springer commented 9 years ago

== is object identity (defined as "pointer address" in Squeak), so why would x == x ever be false regardless of the value of x?

krono commented 9 years ago

Explanation:

krono commented 9 years ago

On 16.06.2015, at 20:41, Matthias Springer notifications@github.com wrote:

== is object identity, so why would x == x ever be false regardless of the value of x?

Boxed objects would do that. But there are ways around that.