-
Notifications
You must be signed in to change notification settings - Fork 17
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
Comments
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. |
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. |
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. |
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. |
Resolved in v2.1 of the package thanks to Jhericks. |
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]
The text was updated successfully, but these errors were encountered: