Skip to main content

solve_bracket

Function solve_bracket 

fn solve_bracket(flows: &[(f64, f64)], basis: YieldBasis) -> (f64, f64)
Expand description

The bracket a yield solve searches, given the basis it is quoted on.

The nominal bracket is [−50%, 200%], but the price/yield relationship is not continuous over it for every basis. Simple interest discounts by 1/(1 + y·t), which has a pole at y = −1/t — inside the nominal bracket for any flow past two years — and periodic compounding by (1 + y/f)^(−f·t), singular at y = −f. Bisecting across a pole is not a slow solve; it is a wrong one, because the sign change it finds is the asymptote rather than the root.

So the lower bound is lifted to just above the highest pole the basis has, and the reported YieldSolveError::Unbracketed carries the bracket that was actually searched. Continuous compounding has no pole and keeps the nominal bound.