pub fn decimal_to_f64_safe(decimal_value: Decimal, tolerance: f64) -> f64Expand description
Safe Decimal to f64 conversion with precision warnings
This function performs precision validation and emits warnings in debug builds when significant precision loss occurs.
§Arguments
decimal_value- The Decimal value to converttolerance- Acceptable relative error (default: 1e-12 for financial calculations)
§Returns
The f64 value, or NaN if conversion fails
§Example
use rust_decimal_macros::dec;
use rusty_common::decimal_utils::decimal_to_f64_safe;
let price = dec!(123.45);
let f64_price = decimal_to_f64_safe(price, 1e-15);
assert_eq!(f64_price, 123.45);