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
Fix #1671: Fix {Float,Double}.toInt for large abs values. #1676
Conversation
Review by @nicolasstucki |
Refer to this link for build results (access rights to CI server needed): https://scala-webapps.epfl.ch/jenkins/job/scalajs-pr/1715/ |
Isn't there be the same problems with |
|
Oh, nice and simple. |
Updated. I had to add a commit fixing some of our low-level algorithms, which were relying on the buggy behavior of |
Refer to this link for build results (access rights to CI server needed): https://scala-webapps.epfl.ch/jenkins/job/scalajs-pr/1718/ |
Refer to this link for build results (access rights to CI server needed): https://scala-webapps.epfl.ch/jenkins/job/scalajs-pr/1720/ |
Some low-level algorithms in java.util.Random and scala.scalajs.runtime.Bits relied on the buggy behavior of (x: Double).toInt. This commit fixes this by explicitly using a `rawToInt` function that uses `x | 0` explicitly with js.Dynamic.
Rebased. |
Refer to this link for build results (access rights to CI server needed): https://scala-webapps.epfl.ch/jenkins/job/scalajs-pr/1724/ |
The behavior of ToInt32(x) in ES does not match the behavior of (int) x on the JVM for values that are lower than Int.MinValue or larger than Int.MaxValue. On the JVM, and hence for .toInt, they are clamped at Int.MinValue or Int.MaxValue, respectively. So we have to handle these cases separately.
LGTM |
Refer to this link for build results (access rights to CI server needed): https://scala-webapps.epfl.ch/jenkins/job/scalajs-pr/1725/ |
Fix #1671: Fix {Float,Double}.toInt for large abs values.
The behavior of
ToInt32(x)
in ES does not match the behavior of(int) x
on the JVM for values that are lower than Int.MinValue or larger than Int.MaxValue. On the JVM, and hence for .toInt, they are clamped at Int.MinValue or Int.MaxValue, respectively. So we have to handle these cases separately.