Skip to main content

decimal_to_f64

Function decimal_to_f64 

Source
pub unsafe fn decimal_to_f64(decimal: Decimal) -> Option<f64>
Expand description

Converts a DECIMAL to f64 the way DuckDB does.

Returns None if width exceeds DECIMAL_MAX_WIDTH (38) or scale exceeds width. DuckDB indexes its powers-of-ten tables by scale without a bounds check, so such a scale reads past the table (returning inf, NaN or garbage).

ยงSafety

See date_from_days.