try_mul

Multiplies two UINT256 values using a 512-bit intermediate. Arithmetic overflow produces NULL; independently, ordinary scalar NULL propagation produces NULL when either input is NULL.

Scalar function TypesEVM

Example

Runs locally

SELECT try_mul(6::UINT256, 7::UINT256)::VARCHAR AS result;
-- => [{"result":"42"}]

API reference

try_mul(UINT256, UINT256) #

Returns a * b when the 512-bit product fits UINT256, otherwise NULL.

Inputs

Name Type Use
a UINT256

UINT256 factor.

required positional
b UINT256

UINT256 factor.

required positional

Returns

Name Type
product UINT256

Checked product. UINT256 product, or NULL for arithmetic overflow or an input NULL.