Skip to main content

Try it Live

Run Uint examples in the interactive playground

Uint.dividedBy(a: BrandedUint256, b: BrandedUint256): BrandedUint256

Divide Uint256 values. Floor division (rounds down). Parameters:
  • a: BrandedUint256 - Dividend
  • b: BrandedUint256 - Divisor
Returns: BrandedUint256 - Quotient (floor division) Example:
import { Uint } from 'tevm'

const a = Uint(100n)
const b = Uint(10n)
Uint.dividedBy(a, b)  // 10

// Floor division
const c = Uint(7n)
const d = Uint(2n)
Uint.dividedBy(c, d)  // 3 (not 3.5)

// Division by zero throws
Uint.dividedBy(a, Uint.ZERO)  // Error
Defined in: primitives/Uint/dividedBy.ts:19
Throws error if divisor is zero.

See Also