Skip to content

@assertions:absdiff!

Absolute difference |a - b| computed on-chain — never underflows; @absdiff!(a b) <= d is the composable approximate-equality.

Returns: number

@assertions:absdiff!(a b)
NameTypeDescription
anumberFirst numeric operand
bnumberSecond numeric operand
load assertions
set $oracle 0x0102030405060708090a0b0c0d0e0f1011121314
# Composable approximate equality between two live values
assertions:assert @absdiff!($oracle::{price()(uint256)} $oracle::{twap()(uint256)}) <= 50e8 "price diverged"