Skip to content

Commit

Permalink
fix isubn sign issue
Browse files Browse the repository at this point in the history
When we sub number from BN instance and this number equal to number in
BN instance we receive zero with negative sign.
  • Loading branch information
fanatid committed Feb 25, 2019
1 parent 24cc2dd commit 7d12569
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bn.js
Original file line number Diff line number Diff line change
Expand Up @@ -2160,7 +2160,7 @@

// Possible sign change
if (this.negative !== 0) {
if (this.length === 1 && (this.words[0] | 0) < num) {
if (this.length === 1 && (this.words[0] | 0) <= num) {
this.words[0] = num - (this.words[0] | 0);
this.negative = 0;
return this;
Expand Down

0 comments on commit 7d12569

Please sign in to comment.