Skip to main content

f64_to_decimal

Function f64_to_decimal 

Source
pub unsafe fn f64_to_decimal(value: f64, width: u8, scale: u8) -> Decimal
Expand description

Converts an f64 into a DECIMAL of the given width and scale.

When DuckDB cannot convert — the value does not fit DECIMAL(width, scale), it is NaN or infinite, width exceeds 38, or scale exceeds width — the result is Decimal { width: 0, scale: 0, value: 0 }, not an error. Use try_f64_to_decimal to get None instead.

§Safety

See date_from_days.