v3.3.0
Pure optimization release. Same API, same precision, same return values to the last wei — just fewer opcodes in stdNormCDF. Every option pricer and greek built on the standard normal CDF gets the savings automatically.
What changed
- Inlined
erfPositiveHalfintostdNormCDFand removed the redundant(·1/√2) · √2round-trip. The helper had no other callers, so it's gone. - Each branch now writes straight to the result in assembly — no shared
tplumbing, no0.5 ± halfpost-processing. - Helper
erfPositiveHalfand itsMathWrapperexternal removed. INV_SQRT_2constant removed (no longer used).
Gas savings
| Function | v3.2.0 | v3.3.0 | Saved | % |
|---|---|---|---|---|
stdNormCDF |
734 | 660 | −74 | −10.1% |
callOptionPrice |
2,876 | 2,729 | −147 | −5.1% |
putOptionPrice |
2,887 | 2,739 | −148 | −5.1% |
delta |
1,797 | 1,724 | −73 | −4.1% |
theta |
3,441 | 3,293 | −148 | −4.3% |
binaryCallPrice |
2,092 | 2,018 | −74 | −3.5% |
binaryPutPrice |
2,097 | 2,023 | −74 | −3.5% |
binaryTheta |
3,501 | 3,353 | −148 | −4.2% |
impliedVolatility (call) |
13,100 | 12,370 | −730 | −5.6% |
impliedVolatility (put) |
13,184 | 12,446 | −738 | −5.6% |
gamma, vega, binaryDelta, binaryGamma, binaryVega unchanged — they use the standard normal PDF, not the CDF.
Validation
- All 572 tests pass at the same precision thresholds as v3.2.0.
- Strict-equality perf assertions caught every gas drift automatically — no silent regressions or "improvements" possible.
Install
npm install defimath-lib@3.3.0
Links
- Full write-up: https://defimath.com/news/2026-06-09-defimath-v3-3-0-released/
- npm: https://www.npmjs.com/package/defimath-lib
- Compare with v3.2.0: v3.2.0...v3.3.0