I need to understand a couple of things:

  1. What is the maximum value an int and uint can store?
  2. Are the maximum values stored in int and uint the same?
  • An uint is 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?
  • An int is short for int256 and 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 uint and 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

  • 2^256/2 - 1 = 2^255 -1 – Igor Yalovoy Feb 12 '19 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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