Skip to content

Inconsistent Behavior of Double#NaN #7677

Closed
@adamgfraser

Description

@adamgfraser

We noticed some inconsistent behavior involving Double.NaN when enabling one the ZIO test suites on Dotty. The following snippet will print true and false on Dotty 0.20.0-RC1 whereas it will print false and false on Scala 2.13.1. I saw that there was another issue reported regarding Double.NaN in #6710 but it looks like that was resolved back in June so this appears to be different, though potentially related.

Please let me know if there is anything else I can do to help!

object Example extends App {
  val a: Double = Double.NaN
  val eval = (a <= 0) || (10L <= 0)
  println(s"when Double.NaN is extracted to val, expression is evaluated to: $eval")
  val eval2 = (Double.NaN <= 0) || (10L <= 0)
  println(s"when Double.NaN is used directly, expression is evaluated to: $eval2")
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions