Latest News
DeFiMath v4.1.0: φ(x) joins Φ(x)
The normal CDF has been in DeFiMath for as long as it has priced options. v4.1.0 adds its derivative — stdNormPDF, the standard normal density — at 320 gas, completing the Gaussian pair. Drop-in from v4.0.0.
Read more →DeFiMath v4.0.0: Black-76 options on futures, and a cleaner API
The first major release since v3.0.0. A new Black-76 module prices European options on a future — call, put, the four Greeks, and a Newton-Raphson IV solver, from 2,552 gas. And every library is renamed for a cleaner API — DeFiMathOptions becomes BlackScholes, finance/ splits into rates/ and statistics/, and redundant function prefixes are gone. Plus an expired-put delta fix.
Read more →DeFiMath v3.7.0: a rebuilt exp cascades across the library
exp is rebuilt on a two-stage range reduction plus a [3,3] Padé approximant — 327 → 289 gas with a tighter error bound. Because exp underpins Black-Scholes pricing, the Greeks, the IV solver, futures, and rate math, the savings cascade — callOptionPrice −126, continuousToDiscrete −116, expm1 −112. Error bounds tightened across primitives, and all gas + precision figures now live in a single Constants.mjs asserted in CI.
Read more →DeFiMath v3.6.0: sqrt and cbrt handle full uint256
sqrt and cbrt rewritten to handle the full uint256 domain — no more SqrtUpperBoundError or CbrtUpperBoundError. sqrt drops from 245 to 197 gas (−20%), cbrt from 368 to 340 (−8%). sqrtTime also gets a new CLZ-derived seed algorithm. Plus a pow overflow bugfix, and cascading savings across Options, Binary options, Rates, and Statistics.
Read more →DeFiMath v3.5.0: Extended boundaries
Three input ceilings pushed out to their actual mathematical limits — sqrt accepts the full FP18-safe uint256 range, Options and Binary admit horizons up to 32 years. Same precision, same gas, no API change.
Read more →DeFiMath v3.4.0: Foundry property-fuzz testing layer added
Adds a Foundry property-based fuzz testing layer — 92 mathematical properties × 32,000 random runs = 2.94M executions per CI run. Plus a signed-int refactor of EXP_LOWER_BOUND that saves 1–3 gas across every function calling exp.
Read more →DeFiMath v3.3.0: stdNormCDF rewrite, call/put 5% cheaper
Pure optimization release. Black-Scholes call and put each drop ~5% in gas; every option pricer and greek that touches the standard normal CDF gets faster.
Read more →DeFiMath v3.2.0: 7 new utility math primitives
Adds mulDiv, mul, abs, min, max, clamp and avg to the Math module — the small primitives every DeFi protocol ends up reimplementing.
Read more →DeFiMath v3.1.0: cbrt function
Adds a CLZ + Newton-Raphson cube root that beats Solady's cbrtWad by ~33% on gas at identical precision.
Read more →DeFiMath v3.0.0: Portfolio analytics module
A major release adding statistics, risk and return functions for on-chain portfolio analytics, with a Solidity bump and 100% test coverage.
Read more →DeFiMath v2.0.0: API rename, finance module
Breaking — function names drop the `get` prefix. Adds compound interest, present value, log returns, and continuous/discrete conversions.
Read more →DeFiMath v1.0.4: CLZ-based ln, sqrt and sqrtTime
Core math primitives rewritten using count-leading-zeros for tighter gas.
Read more →DeFiMath v1.0.3: Benchmarks split into own repo
DeFiMath is now a focused Solidity library; benchmark comparisons live in the new defimath-compare repo.
Read more →