alibaba-archive / node-biginteger

node.js version of java.math.BigInteger
10 stars 5 forks source link

Losing last bits when you dump Hexa. #15

Open jio-gl opened 4 years ago

jio-gl commented 4 years ago

These zeroes doesn't look good to me:

new BigNumber(1234567890).toString(16); '499602d2' new BigNumber(12345678901234567890).toString(16); 'ab54a98ceb1f0758' new BigNumber(12345678901234567890).toString(16); 'ab54a98ceb1f0758' new BigNumber(123456789012345678901234567890).toString(16); '18ee90ff6c373e1ee21c50000' new BigNumber(12345678901234567890123456789012345678901234567890).toString(16); '8727f6369aaf810be6024386f42d0f04600000000'

jio-gl commented 4 years ago

In Python has now zeroes at the end:

hex(1234567890) '0x499602d2' hex(12345678901234567890) '0xab54a98ceb1f0ad2' hex(12345678901234567890) '0xab54a98ceb1f0ad2' hex(123456789012345678901234567890) '0x18ee90ff6c373e0ee4e3f0ad2' hex(12345678901234567890123456789012345678901234567890) '0x8727f6369aaf83ca15026747af8c7f196ce3f0ad2'