Open
Description
Problem
Several pricing reductions initialize accumulators with literal 0.0, including generic present_value methods and cap, floor, and swaption pricing.
Nonempty computations usually promote after the first operation, but empty projections always return Float64 regardless of the model/cashflow scalar type. Fixed literals also make generic AD and arbitrary-precision behavior less predictable.
Proposed direction
Use an identity derived from the relevant model, cashflow amount, or computed contribution type. Where inference makes that difficult, structure the reduction so the first contribution establishes the accumulator type while still handling empty projections explicitly.
Review nearby 1.0 identities where they participate in typed accumulators as well.
Acceptance criteria
- Empty and nonempty present-value paths preserve an appropriate scalar type for AD and
BigFloatinputs. - Cap, floor, and swaption accumulation does not force
Float64. - Existing numerical results remain unchanged.
- Tests include empty/past-maturity projections and at least one non-
Float64scalar type.
Metadata
Metadata
Assignees
Labels
No labels
Activity
Value empty projections and caps in the model's number type
Value empty projections and caps in the model's number type
alecloudenback commentedon Oct 11, 2026
Review update against FinanceModels v7.0.0 (
6cb71714), 2026-10-11.Mostly resolved; remaining priority: medium, overlapping #107. Generic present-value reductions and empty cap/floor values now preserve BigFloat and ForwardDiff values appropriately. The corresponding regression checks pass.
The broader Float32 criterion is not yet met. An entirely Float32 Vasicek model still returns Float64 for a Float32 cap, floor, or swaption, including a one-period cap with no caplets. The strip and swaption code use Float64 period/weight literals; this is wider than the accumulator identity alone.
See cap/floor strip and swaption schedule. Suggested scope: track the remaining Float32 widening with #107, then close this issue once that overlap is explicitly accounted for.
Value empty projections and caps in the model's number type