Function tantivy_common::f64_to_u64
source · pub fn f64_to_u64(val: f64) -> u64
Expand description
Maps a f64
to u64
For simplicity, tantivy internally handles f64
as u64
.
The mapping is defined by this function.
Maps f64
to u64
in a monotonic manner, so that bytes lexical order is preserved.
This is more suited than simply casting (val as u64
)
which would truncate the result
§Reference
Daniel Lemire’s blog post explains the mapping in a clear manner.
§See also
The reverse mapping is u64_to_f64()
.