I need to understand a couple of things:
- What is the maximum value an int and uint can store?
- Are the maximum values stored in int and uint the same?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
uintis short for
uint256, so it can store 2^256 values - because it's unsigned the maximum value is 2^256-1 (zero needs one space). What is the maximum input value for function uint256 parameter?
intis short for
int256and it can store the same amount of values - because it's signed the maximum (positive) value is 2^256 / 2 - 1.
So the maximum values of
int are not the same. They have the same amount of values but
int needs to store values also for negative numbers.
You can find more details at: Max/min values of standard data types