blockulator

Every library is scored in its own rounding direction: a result is wrong if it is not the integer that direction gives, if it reverts where the value fits, or if it returns a value where none fits. BlockulatorWad computes each function in FP19 and decides the last wei exactly.

Share wrong

Fixed point
function · share wrongBWadSoladySolmatePRB SDPRB UDsnekOZUniswap
mulWad013%13%0—000
mulWadUp013%13%——000
divWad033%33%0—000
divWadUp033%33%——000
sMulWad011%11%0————
sMulWadDown0———————
sMulWadUp0———————
sDivWad034%34%0————
sDivWadDown0———————
sDivWadUp0———————
sqrtWad0023%23%——23%—
sqrtWadUp0—————23%—
cbrtWad00———23%——
cbrtWadUp0———————
expWad048%48%72%93%48%——
expWadUp0———————
lnWad024%24%98%98%24%——
lnWadUp0———————
log2Wad0——93%90%———
log2WadUp0———————
log10Wad0——88%90%———
log10WadUp0———————
powWad058%58%64%80%———
powWadUp0———————
lambertW0Wad028%——————
lambertW0WadDown0———————
lambertW0WadUp0———————

Hover a cell for the counts: how many were wrong, how many reverted where the value fits, and the direction scored.

Worst error

Fixed point
function · worst, in weiBWadSoladySolmatePRB SDPRB UDsnekOZUniswap
mulWad0000—000
mulWadUp000——000
divWad0000—000
divWadUp000——000
sMulWad0000————
sMulWadDown0———————
sMulWadUp0———————
sDivWad0000————
sDivWadDown0———————
sDivWadUp0———————
sqrtWad0000——0—
sqrtWadUp0—————0—
cbrtWad00———1.00e+12——
cbrtWadUp0———————
expWad06.16e+566.16e+562.08e+592.08e+596.16e+56——
expWadUp0———————
lnWad01127271——
lnWadUp0———————
log2Wad0——1918———
log2WadUp0———————
log10Wad0——1414———
log10WadUp0———————
powWad01.72e+641.72e+649.75e+642.55e+59———
powWadUp0———————
lambertW0Wad01.54e+09——————
lambertW0WadDown0———————
lambertW0WadUp0———————

The largest distance from the exact integer over the values each library returned. A revert counts as wrong above, not here.

Gas

Fixed point
function · gas per callBWadSoladySolmatePRB SDPRB UDsnekOZUniswap
mulWad10786146218—323239179
mulWadUp128110172——391632304
divWad10387146242—323239179
divWadUp128113172——391632304
sMulWad142126131481————
sMulWadDown170———————
sMulWadUp162———————
sDivWad1339397494————
sDivWadDown168———————
sDivWadUp170———————
sqrtWad388393432800——763—
sqrtWadUp408—————1,048—
cbrtWad760619———1,407——
cbrtWadUp777———————
expWad2,3574304302,7312,635604——
expWadUp2,358———————
lnWad2,4155566447,0046,4381,235——
lnWadUp2,416———————
log2Wad2,160——6,6606,306———
log2WadUp2,161———————
log10Wad2,368——8,7448,392———
log10WadUp2,369———————
powWad4,7621,2751,3639,9139,323———
powWadUp4,763———————
lambertW0Wad12,0972,820——————
lambertW0WadDown12,096———————
lambertW0WadUp12,097———————

Median gas of the internal call on everyday inputs (exp of −10..10, ln of 0.001..1000, pow of 0.5..2 to −3..3, products and quotients of amounts up to 109 tokens). Full counts and the method: wad.md; data: wad.json.