Closed jafri closed 3 years ago
Probably there 2 ways for solving issue:
1) Compare numbers with .eq
method
2) Use internal _strip
for second number
@fanatid _strip does not remove the zeros
Yes, I was wrong :disappointed: ._strip
do not remove zeros, it's only changing .length
property.
.eq
method should be used.
When deep comparing these two big numbers I got inequality error from Jest
new BN(0.0001 * Math.pow(10, 18))
new BN('00000000000000000000000000000000000000000000000000005af3107a4000', 16)
These are the same numbers, but here are the inner-representations
BN { negative: 0, words: [ 8011776, 1490116 ], length: 2, red: null }
BN { negative: 0, words: [ 8011776, 1490116, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], length: 2, red: null }
From my perspective, the internal representation of both should be the same as they represent the same number