Skip to main content

f64_to_hugeint

Function f64_to_hugeint 

Source
pub unsafe fn f64_to_hugeint(value: f64) -> i128
Expand description

Converts an f64 to HUGEINT the way DuckDB does, truncating toward zero.

A value DuckDB cannot convert — NaN, an infinity, or a value outside (-2^127, 2^127) — comes back as 0, indistinguishable from a real zero (SQL’s CAST raises an error instead). Use try_f64_to_hugeint to tell the two apart.

§Safety

See date_from_days.