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

BigInteger.intValue() gives wrong values #32

Open
stevenroose opened this issue Nov 4, 2014 · 1 comment
Open

BigInteger.intValue() gives wrong values #32

stevenroose opened this issue Nov 4, 2014 · 1 comment

Comments

@stevenroose
Copy link
Contributor

In #30 I already mentioned that intValue returns positive values for negative BigIntegers.

I've been using the method a little more, and the results are staggering, so to say.

print(new BigInteger("5000000000").intValue()); // 705032704
print(new BigInteger("705032704").intValue());  // 705032704
print(new BigInteger("7050327040").intValue()); // 2755359744
print(new BigInteger("4755359744").intValue()); // 460392448

JS does not support large integers, so for JS, strange results for large numbers would be no surprise, but these are in the Dart VM.

Since many people already rely on this package, this must be fixed soon. I'd suggest maybe to completely change the implementation, to something more generic like BigInt from the decimal package:
https://github.com/a14n/dart-rational/blob/master/lib/bigint.dart

@adam-singer
Copy link
Member

@stevenroose I do not have time now to maintain this package. IIRC dart team was working on a big num implementation, not sure if it has landed yet.

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

2 participants