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

IE does not support array.splice(negative_value), patch included in issue description #9

Closed
eprost opened this issue Dec 28, 2011 · 2 comments

Comments

@eprost
Copy link

eprost commented Dec 28, 2011

In BigInteger.parse, after "// Optimize 10", the while loop uses digits.splice(-BigInteger.base_log10) which equates to digits.splice(-7).

This is not supported by IE (see ref #2 below) => on IE8 (in "IE8 mode"): infinite loop.

In order to overcome the problem, I have replaced this (around line 392):

var d = [];
while (digits.length >= BigInteger.base_log10) {
d.push(parseInt(digits.splice(-BigInteger.base_log10).join(''), 10));

by this:

var d = [];
while (digits.length >= BigInteger.base_log10) {
d.push(parseInt(digits.splice(digits.length-BigInteger.base_log10, BigInteger.base_log10).join(''), 10));

I have successfully run the test suite with this patched code + rhino 1.7R2-3 on Ubuntu 10.04 x86 (aka "lucid"):

./run-test
[...]
Finished in 12.175
Passed 29/29 (100.00%): PASS

References :
1 - splice() at MDN: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice
2 - splice() at MSDN: http://msdn.microsoft.com/en-us/library/wctc5k7s(v=VS.94).aspx

@silentmatt
Copy link
Owner

IE compatibility has pretty much been an afterthought so I didn't catch that. Thanks!

@eprost
Copy link
Author

eprost commented Dec 31, 2011

You're welcome, thank * your * for distributing your code.

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