Skip to content

Latest commit

 

History

History
6 lines (4 loc) · 812 Bytes

Integer_Arithmetic.md

File metadata and controls

6 lines (4 loc) · 812 Bytes

Neither the EVM nor Solidity (before v0.8) provide builtin error reporting for arithmetic overflow/underflow. Consequently, applications need to check for these cases themselves. Furthermore, one cannot make the (seemingly reasonable) assumption that x != -x, because of this case.

Note that since Solidity version 0.8, arithmetic operations revert on overflow and underflow. The developer can choose to bypass these checks by using the unchecked keyword, for example with unchecked { x = a + b; }