-
Notifications
You must be signed in to change notification settings - Fork 154
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
Bug in parseBase for numbers containing a dot ('0.0079') #90
Comments
The same applies to new BN('1234', 16) // <BN: 1234>
new BN('12.34', 16) // <BN: 12e34> |
I know that it should throw, but it doesn't right now. The thing is that this is an big integer library, so you should not really pass data like this to it. |
I do know that and I don't pass those kind of numbers. However, users of my library are. I can either do pre-processing there which is quite big of an overhead. I would prefer bn.js to throw, I have the PR ready, will submit it soon - it is quite small. |
A note on the integer side, the library's name is short for big number and doesn't specifically mentions anywhere it is integers and not decimals. I know that, but it is not clear from the first sight at the README, maybe it should be updated. |
Yeah, I totally agree. It should be updated. Thanks! |
|
A note was added to the README at some point
|
It throws now. |
_init
,parseBase
or_parseBase
will not care if a dot is included in a base-10 input, will process it as('.' - 48) & 0xf
.I think it should just reject such input?
The text was updated successfully, but these errors were encountered: