Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operation involing math.round() and Double.NaN doesn't return NaN #10063

Closed
scabug opened this issue Nov 15, 2016 · 2 comments
Closed

Operation involing math.round() and Double.NaN doesn't return NaN #10063

scabug opened this issue Nov 15, 2016 · 2 comments

Comments

@scabug
Copy link

scabug commented Nov 15, 2016

On Scala 2.11.8
math.round(Double.NaN * 20d) / 20d
returns 0
Would it make more sense to return Double.NaN?

@scabug
Copy link
Author

scabug commented Nov 15, 2016

Imported From: https://issues.scala-lang.org/browse/SI-10063?orig=1
Reporter: Tri Nguyen
Affected Versions: 2.11.8

@scabug
Copy link
Author

scabug commented Nov 15, 2016

@SethTisue said:

scala> java.lang.Math.round(Double.NaN)
res3: Long = 0

Even if we don't think this is the “right” answer, in general scala.math just wraps the Java stuff.

@scabug scabug closed this as completed Nov 16, 2016
@scabug scabug added the quickfix label Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant