The Numba-compiled financepy.models.cir_montecarlo.zero_price can return a price far above one, or NaN, for nonnegative CIR parameters whose model price is finite.
Reproduced on PyPI 1.1.2 and source 2b9227fea9d832c4033421d6cd53a54316414fca:
from financepy.models.cir_montecarlo import zero_price
print(zero_price(0.03, 0.1, 0.05, 1e-10, 10.0))
# Actual: 2.2407257971155513e96
# Expected: 0.6882687528140472
Here sigma=1e-10 is a deliberately small stress input. With nonnegative short rates, a unit payment's discounted value must remain within [0,1]. The reference evaluates the affine closed form at 80 and 120 decimal digits for the exact binary64 inputs, with separate Riccati-ODE checks.
The base raised to 2*a*b/sigma**2 amplifies rounding at small positive volatility. Other tested regimes expose positive-exponential overflow and cancellation in the zero-volatility branch. These are grouped as one pricing-component report.
A local algebraic candidate uses hypot, expm1, log1p and log-space evaluation; it does not clip prices or replace small nonzero volatility with zero. On a predeclared 4,536-vector grid and fixed tolerance, original / candidate / restored original / release have respectively 1,168 / 0 / 1,168 / 1,168 failing prices. All 3,368 previously passing prices still meet that tolerance (not all are bitwise unchanged). Forty existing CIR tests pass on original and candidate. A fresh-cache repeat reproduced all four result files byte-for-byte.
Environment: macOS 15.5 arm64; Python 3.12.14; NumPy 2.3.5; Numba 0.62.1; SciPy 1.16.3; mpmath 1.3.0. Actual native nopython execution.
Report, reproduction and immutable evidence · Candidate patch · GitHub mirror.
A bounded issue/history search found no exact duplicate; #23 and #167 appear to concern different functionality. No full-suite, calibration, Greek, portfolio or production-bank impact is claimed. The patch is a local candidate.
Independent GERO research by Xamit Kadirbekov, prepared with AI assistance and checked against the retained execution evidence.
The Numba-compiled
financepy.models.cir_montecarlo.zero_pricecan return a price far above one, or NaN, for nonnegative CIR parameters whose model price is finite.Reproduced on PyPI 1.1.2 and source
2b9227fea9d832c4033421d6cd53a54316414fca:Here sigma=1e-10 is a deliberately small stress input. With nonnegative short rates, a unit payment's discounted value must remain within [0,1]. The reference evaluates the affine closed form at 80 and 120 decimal digits for the exact binary64 inputs, with separate Riccati-ODE checks.
The base raised to
2*a*b/sigma**2amplifies rounding at small positive volatility. Other tested regimes expose positive-exponential overflow and cancellation in the zero-volatility branch. These are grouped as one pricing-component report.A local algebraic candidate uses hypot, expm1, log1p and log-space evaluation; it does not clip prices or replace small nonzero volatility with zero. On a predeclared 4,536-vector grid and fixed tolerance, original / candidate / restored original / release have respectively 1,168 / 0 / 1,168 / 1,168 failing prices. All 3,368 previously passing prices still meet that tolerance (not all are bitwise unchanged). Forty existing CIR tests pass on original and candidate. A fresh-cache repeat reproduced all four result files byte-for-byte.
Environment: macOS 15.5 arm64; Python 3.12.14; NumPy 2.3.5; Numba 0.62.1; SciPy 1.16.3; mpmath 1.3.0. Actual native nopython execution.
Report, reproduction and immutable evidence · Candidate patch · GitHub mirror.
A bounded issue/history search found no exact duplicate; #23 and #167 appear to concern different functionality. No full-suite, calibration, Greek, portfolio or production-bank impact is claimed. The patch is a local candidate.
Independent GERO research by Xamit Kadirbekov, prepared with AI assistance and checked against the retained execution evidence.