-
Notifications
You must be signed in to change notification settings - Fork 21
-
Notifications
You must be signed in to change notification settings - Fork 21
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
BigInt.isValidInt gives an incorrect result for large numbers #4540
Comments
Imported From: https://issues.scala-lang.org/browse/SI-4540?orig=1 |
@dragos said: |
@nadezhin said: def testDoubleIsValidByte() {
assert((0.0).isValidByte)
}
def testLongIsValidByte() {
assert(!(1L << 32).isValidByte)
} The expected behaviour - these tests should pass. Preparing a pull request... |
@nadezhin said: |
Stephane Bersier (stephane bersier) said: /** Returns This fails any time n % 2^64 == n % 2^32 and |n| > 2^64. For example 2^65 + 1. |
@nadezhin said: I am not sure how this bug can happen. |
Stephane Bersier (stephane bersier) said: |
=== What steps will reproduce the problem (please be specific and use wikiformatting)? ===
=== What is the expected behavior? ===
=== What do you see instead? ===
=== Additional information ===
From what I understood, the problematic code is in
ScalaNumericConversions.scala
:which won't work for numbers larger than 64 bits.
=== What versions of the following are you using? ===
The text was updated successfully, but these errors were encountered: