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.longValue() missing #30

Open
stevenroose opened this issue Apr 1, 2014 · 4 comments
Open

BigInteger.longValue() missing #30

stevenroose opened this issue Apr 1, 2014 · 4 comments

Comments

@stevenroose
Copy link
Contributor

CORRECTION: see first comment

Java's BigInteger has a longValue() getter to return the BigInteger's value as a long.

dart-bignum's only has an intValue(). While Dart does not have a long type, the integer type does support numbers larger than 32 bits. However, the intValue() getter caps the value at 32 bits.

So there should be a longValue() getter that allows for numbers up to 64 bits. Dart supports 64-bit integers and JS also supports ints larger than 32 bits.

I tried to look at it myself, but I don't fully understand the code. (Does the JS BigInteger have a longValue()?)

@stevenroose
Copy link
Contributor Author

Ok, it seems that the intValue() getter does work as a longValue() getter, but only works for positive values.

Check this:

new BigInteger(-2147483647).intValue() returns to 2147483649

@adam-singer
Copy link
Member

@stevenroose was that in javascript or dartvm, or both?

@stevenroose
Copy link
Contributor Author

That was in dartvm. I did not test in JS
On Apr 2, 2014 5:55 AM, "Adam Singer" [email protected] wrote:

@stevenroose https://github.com/stevenroose was that in javascript or
dartvm, or both?

Reply to this email directly or view it on GitHubhttps://github.com//issues/30#issuecomment-39286596
.

@adam-singer
Copy link
Member

Would have to think about this more... Dont have a good plan about "fixing" this.

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