Skip to content

Different semantics for Double.NaN between Scala2 and Dotty #6710

Closed
@liufengyun

Description

@liufengyun

minimized code

Dotty REPL:

scala> Double.NaN > 0.0
val res1: Boolean = true
scala> Float.NaN > 0.0
val res2: Boolean = true
scala> Float.NaN < 0.0
val res3: Boolean = true
scala> Double.NaN < 0.0
val res4: Boolean = true

expectation

Should return false, as in Scala REPL:

scala> Double.NaN > 0.0
res1: Boolean = false
scala> Float.NaN > 0.0
val res2: Boolean = false
scala> Float.NaN < 0.0
val res3: Boolean = false
scala> Double.NaN < 0.0
val res4: Boolean = false

This is discovered when working with ScalaTest test set.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions