0

I noticed that BigNumber is a special data type in ethereum, and you can't do typical arithmetic operations on it that you would a regular uint. What is the big number, and why does ethereum/(solidity?) have it?

2 Answers 2

1

Solidity itself does not have BigNumber.

You might be referring to JavaScript BitNumber libraries or Solidity libraries. Without further context, it is not possible to know what you are referring to.

1
  • I was just referring to the datatype. I see JS has its own BigNumber data type, maybe its from JS. I did not know that Commented Apr 8, 2021 at 20:34
1

Solidity can handle very big numbers. To be able to use those numbers in javascript, we convert those big numbers into BN (Big Number) object. for example

//  1 ether=10**18
const a=Math.pow(10, 18)
a=1000000000000000000

const b=a+3
b=1000000000000000000

a===b  // true

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.