evm_addmod

Implements EVM ADDMOD: computes (a + b) mod n using the full mathematical sum, without UINT256 wraparound, and returns zero when n is zero. NULL input propagates to NULL.

Example

Local

1
SELECT evm_addmod(7::UINT256, 5::UINT256, 10::UINT256)::VARCHAR AS result;
2
-- => [{"result":"2"}]
Notebook ready in readonly mode.

API reference

Exact signatures with descriptions, requirements, inputs, returns, and examples.

evm_addmod(UINT256, UINT256, UINT256) #

EVM ADDMOD over three UINT256 words using a 512-bit sum.

Inputs

Name Type Use
a UINT256

UINT256 addend.

required positional
b UINT256

UINT256 addend.

required positional
n UINT256

UINT256 modulus; zero returns zero.

required positional

Returns

Name Type
result UINT256

Modular sum. UINT256 residue in [0,n), zero for n=0, or NULL for NULL input.

Category and tags

Category
EVM utilities
Tag
Types
Tag
EVM