INT256

256-bit signed EVM integer stored as a 32-byte two's-complement ABI word. Decimal string casts parse exact numeric values; 0x-prefixed strings parse raw bytes. VARCHAR output is decimal for display; use sort_key for signed ordering and BYTES/BYTES32 casts for raw ABI/storage boundaries.

Family
Signed integer
Physical
BLOB
Used by
12 functions
Examples
0 samples

Used by functions

Derived from generated function parameters and return types.

Input and output

  • evm_sar

    Implements EVM SAR over a two's-complement INT256 word: right shifts with sign-bit fill. Counts at least 256 return -1 for negative x and 0 otherwise. Negative SQL BIGINT counts throw Invalid Input Error: Shift amount must be non-negative. NULL input propagates to NULL.

    scalar function Offline 1 overload
  • muldiv

    x * y / z with a 512-bit product: no overflow before division. UINT256 rounds down, INT256 truncates toward zero, unless a rounding mode is given. Errors when z is zero or result does not fit its type. NULL propagates. Native integer arguments fit both forms: cast them to UINT256 or INT256.

    scalar function Offline 2 overloads

Accepted as input

  • clmm_swap_step_x96

    Computes one Uniswap v4 SwapMath-compatible price-range step. Negative amount_remaining means exact input; non-negative means exact output. Direction is inferred from current versus target. Hooks, dynamic fee resolution, tick-crossing liquidity changes, multi-word iteration, slippage, routing, and calldata are outside this deterministic helper. The five-argument overload uses Uniswap v4's 1,000,000 fee denominator.

    scalar function Offline 2 overloads
  • clmm_swap_x96

    Exact swap across initialized ticks, as the Uniswap v3 and v4 swap loop: each step ends at the next listed tick or the tick-bitmap word edge (256 x tick_spacing), whichever is first, with clmm_swap_step_x96 math; crossing adds liquidity_net moving up, subtracts it moving down. Stops at the amount, price limit or list end; never assumes liquidity past listed ticks. Offline: caller reads state and ticks. No hooks, dynamic fees or protocol fee split. List sorted once per call.

    scalar function Offline 2 overloads
  • evm_abi_word

    Encodes an ADDRESS, BYTES32, BOOLEAN, or integer as one 32-byte Solidity ABI word. ADDRESS and unsigned integer values are left-padded with zeros. Signed integers are sign-extended in two's-complement form; BOOLEAN uses 0 or 1. BYTES32 values are copied unchanged.

    scalar function Offline 1 overload
  • evm_sign

    Returns -1 for a negative two's-complement INT256 value, 0 for zero, and 1 for a positive value. NULL input propagates to NULL.

    scalar function Offline 1 overload
  • fixed_exp

    Computes e^(x / 1e18) * 1e18 for an 18-decimal fixed-point (WAD) exponent, with integer arithmetic only. NULL propagates; an exponent outside [-41e18, 130e18] errors. Results equal, digit for digit, those of the LogExpMath library that Balancer V2 and Pendle V2 contracts use, so a query recomputes an on-chain rate exactly. Accuracy: within 1e-17 relative for results of 1e17 or more; a few wei near 1e18 (exp(1e18) is 2718281828459045235); a tiny result keeps few digits (exp(-41e18) is 1, true 1.56).

    scalar function Offline 1 overload
  • format_ether

    Human-readable helper for wei balances. Equivalent to format_units(amount, 18). Returns VARCHAR without introducing floating point conversion.

    scalar function Offline 1 overload
  • format_units

    Scales raw EVM integer balances by 10^decimals and returns a VARCHAR string representation. No floating point conversion is introduced. The default decimal scale is 18. INT256 inputs preserve signed values, and trailing fractional zeros are trimmed from the formatted string.

    scalar function Offline 4 overloads
  • length

    Returns the number of bytes in a BLOB or BLOB-backed EVM value such as ADDRESS, BYTES32, UINT256, or INT256.

    scalar function Offline 1 overload
  • sort_key

    Converts INT256/INT512/UINT256/UINT512 to a sortable BLOB for use in ORDER BY. Necessary because Determica's default BLOB ordering doesn't handle signed integers correctly. Use sort_key only inside ORDER BY or comparison-key workflows; it is not a human-readable number conversion, hash, or portable serialization.

    scalar function Offline 1 overload

Returned as output

  • fixed_ln

    Computes ln(x / 1e18) * 1e18 for a positive 18-decimal fixed-point (WAD) value, with integer arithmetic only; arguments in (0.9e18, 1.1e18) use a 36-decimal series. NULL propagates. Results equal, digit for digit, those of the LogExpMath library that Balancer V2 and Pendle V2 contracts use, so a query recomputes an on-chain rate exactly. Accuracy: within 2 wei of the true value, on either side.

    scalar function Offline 1 overload