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

Rounding problem for numbers > 2^53 (15.9 decimal digits) #8

Closed
thedewi opened this issue Jun 3, 2015 · 5 comments
Closed

Rounding problem for numbers > 2^53 (15.9 decimal digits) #8

thedewi opened this issue Jun 3, 2015 · 5 comments

Comments

@thedewi
Copy link

thedewi commented Jun 3, 2015

Javascript numbers cannot represent every integer above 2^53 (15.9 decimal digits), but credit card numbers can be up to 19 digits. This can give the rightmost moduli a rounding error.

Fortunately, most payment gateways only take up to 16 digits, and as far as I know no valid numbers begin with 9, so this only will only affect rare 17-19 digit card numbers. But it confused me when I hit it. :)

Problem example (Laser test number): 6304985028090561515 [% 10 == 6]

@JamesEggers1
Copy link
Owner

This is something I will keep open to review additional card holders and see how the algorithm will need to change.

However, at the moment, I'm going to make this a lower priority since Laser Card Services is no longer active per the company's website - http://www.ipso.ie/section/LaserCardServicesLtd.

@thedewi
Copy link
Author

thedewi commented Jun 22, 2015

Yeah, I'm not aware of any current services either. There may be no practical impact. I think it's more a source of confusion / failing tests.

@JamesEggers1
Copy link
Owner

I'm getting ready to push a v2.0 version of the module to clean up the interface and change the custom client-side aspect of it to use Bower. Along with that push I'll be expanding the tests to include more tests. In the event that I can bring in the Laser Card example (or similar one) I'll make sure to update this issue and close it.

@JamesEggers1
Copy link
Owner

I'm testing out a few Big Number packages in order to understand how to use potentially integrate them into the algorithm. This is an issue and edgecase but it's also one I want to try and fix. Look for a solution soon and I'll post back here once it's implemented.

@JamesEggers1
Copy link
Owner

Resolved in v2.1 of the package thanks to Jhericks.

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