blockulator

Per op

Gas and single-call precision for FP127 against ABDK, Quad, Solady, PRBMath and Balancer.

Gas per op

opYul object (staticcall)FP127Lib (inline)ABDKMath64x64SoladyPRBMath SD59x18ABDKMathQuadBalancer LogExpMath
abs745708594—643588—
add14592895875025061252—
atanh87019846—————
avg1895581497—416——
cbrt67197263—859——2457
ceil896742——700——
compound53664573—————
cosh921711389—————
dist1017855—————
div14389815463297051209512
erf2020123274—————
erfc2055623278—————
exp553253663542547295160721191
exp1048865734—————
exp2536052012985—6384534—
expm169958018—————
factorial15941381—————
floor1650667——708——
frac1481722——612——
fromFixed1813761060—————
gavg429739281319—1254——
gcd1301887—————
hypot49184260—————
inv133511215323325541675—
lambertW03623945658—2937———
lambertWm12936235715—————
ln180710357340731109919271358
log1021491085——2712——
log1p47145453—————
log222188977276—8281235—
log2Up1768843—————
max1306554—————
min965536—————
mul17995314553216411036471
neg891694559——585—
normCdf2038923487—————
pi54806065—————
pow609466541932160510062238792412
powu50303263—————
round1020840—————
sign1480660——676——
sinh57806919—————
sqrt379936321159622140212052520
sub15433486265395441768—
tanh74528909—————
toFixed1814211073—————
zeroFloorSub2023806—————

Median gas per op over its input ladder, 2026-10-15. The Yul object column includes the staticcall; the other six are internal library calls. A dash is an op the library does not offer, or that reverted on every ladder input. Min and max per cell are in gas.json; the Huff and FP127Caller columns are in gas.md. Versions: aave aave-v3-origin@8305565ae342 (MathUtils, transcribed), abdk v3.2, balancer balancer-v3-monorepo@2b9ce4b1b8ad (LogExpMath.sol, vendored), forge forge Version: 1.7.1, fp127 279ec8a, huff sepolia:0xfae694D0c2c44181791F838c54Ed64C3151FfE30@11857616, maker dss pot.sol rpow via solady v0.1.26, morpho morpho-blue@8e26ca6a8dbc (MathLib, transcribed), prb-math v4.2.0, solady v0.1.26.

mul and div cost about what they cost in WAD. The transcendentals cost more because they compute twice the bits. Quad and FP256 (its table) pay for the moving point on every op. Only FP127 has erf, erfc, normCdf and Lambert W, and they are the expensive ones.

Precision per op

opvectorsrevertsmin bitsmean bitsworst input
abs961exactexact
add38119exactexact
atanh5345255255 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
avg2000exactexact
cbrt961123152 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ceil952exactexact
clamp3000exactexact
compound14357255255 0xffffffffffffffffffffffffffffffff99b1728cae9854967465fd34ac880ac1,0x0000000000000000000000000000000a00000000000000000000000000000000
cosh5754146253 0x00000000000000000000000000000016a09e667f3bcc908b2fb1366ea957d3e3
dist19010exactexact
div37723exactexact
erf5710255255 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
erfc5710255255 0x0000000000000000000000000000000000000000000000000000000000000001
exp874146221 0x0000000000000000000000000000001400000000000000000000000000000000
exp10663146211 0x0000000000000000000000000000000a00000000000000000000000000000000
exp2803146211 0x0000000000000000000000000000003200000000000000000000000000000000
expm15772146254 0x00000000000000000000000000000016a09e667f3bcc908b2fb1366ea957d3e3
factorial126exactexact
floor970exactexact
frac970exactexact
fromFixed18334exactexact
gavg16634exactexact
gcd810exactexact
hypot1210exactexact
inv623exactexact
lambertW0108365249 0xffffffffffffffffffffffffffffffffa1d2a7274c4320e54521387d6fab06f4
lambertWm166667243 0xffffffffffffffffffffffffffffffffa1d2a7274c4320e54521387d6fab06f3
lerp28911exactexact
ln2994255255 0x0000000000000000000000000000000000000000000000000000000000000001
log102994255255 0x0000000000000000000000000000000000000000000000000000000000000003
log1p56118255255 0x0000000000000000000000000000000000000000000000000000000000000001
log22994255255 0x00000000000000000000000000000000ffbe76c8b4395810624dd2f1a9fbe76c
log2Up2994exactexact
max2000exactexact
min2000exactexact
mul224176exactexact
neg961exactexact
normCdf5710255255 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
pi87122139 0x0000000000000000000000000000000300000000000000000000000000000000
pow36931124235 0x0000000000000000000000000000003039d390f03ddfbfbc409fbb600262981a,0x0000000000000000000000000000001400000000000000000000000000000000
powu30298255255 0x000000000000000000000000000000015cbd69af9ce95a8ff0778c77c7993941,0x0000000000000000000000000000008000000000000000000000000000000000
round952exactexact
sign970exactexact
sinh5754146253 0x00000000000000000000000000000016a09e667f3bcc908b2fb1366ea957d3e3
sqrt2983exactexact
sub38713exactexact
tanh5790255255 0x0000000000000000000000000000000000000000000000000000000000000001
toFixed18970exactexact
zeroFloorSub18911exactexact

Relative correct bits of the 127.128 result, msb(|truth|) − msb(|truth − got|), against mpmath at 200 decimal places over the committed vectors in test/fp127/vectors/. "exact" is bit-identical, or within 2 ULP for an approximated op. Reverts counts vectors where the oracle and the Yul both reject the input with the same error. Source: precision.json.