pub fn decimal_to_f64_checked(
value: Decimal,
context: &'static str,
) -> Result<f64, DecimalConversionError>Expand description
Convert Decimal to f64 for calculations, returning error on failure.
Use this for Black-Scholes and other calculations that require f64. This function explicitly propagates conversion errors instead of silently defaulting to 0.0, which could cause incorrect financial calculations.
§Arguments
value- The Decimal value to convertcontext- A static string describing where this conversion occurs (for error messages)
§Returns
Ok(f64)- The converted valueErr(DecimalConversionError)- If the conversion failed