Skip to content

Latest commit

 

History

History
36 lines (24 loc) · 1.06 KB

08.mdx

File metadata and controls

36 lines (24 loc) · 1.06 KB
fork group
Frontier
Stop and Arithmetic Operations

Index 1 is top of the stack. See PUSH.

Notes

All intermediate calculations of this operation are not subject to the 2256 modulo.

Stack input

  1. a: first integer value to add.
  2. b: second integer value to add.
  3. N: integer denominator.

Stack output

  1. (a + b) % N: integer result of the addition followed by a modulo. If the denominator is 0, the result will be 0.

Examples

* Input Output * * Input Output
1 10 4 * 1 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 1
2 10 * 2 2
3 8 * 2 2

Reproduce in playground.

Error cases

The state changes done by the current context are reverted in those cases:

  • Not enough gas.
  • Not enough values on the stack.