Say I have a smart contract with variable of type uint256
. I write a function to increment this variable.
How does the EVM handle trying to increment the variable to store values beyond 256 bits?
The Solidity docs say the following:
Number literal expressions retain arbitrary precision until they are converted to a non-literal type (i.e. by using them together with a non-literal expression). This means that computations do not overflow and divisions do not truncate in number literal expressions.
So apparently it won't overflow, so what does it do?
(2**800 + 1) - 2**800
, which is larger than any data type.