Enhance float formatting and comparison functions for disk representation

- Made `format_f32` and `format_f64` functions public to allow external access.
- Introduced new constants for disk options and buffer sizes for `f32` and `f64`.
- Added `cleanup_f32` function to clean up float values before comparison.
- Implemented `disk_eq_f32` and `disk_eq_f64` functions to compare float values based on their disk representation.
- Updated `variant_eq_disk` to utilize the new disk equality functions, improving accuracy in matching algorithms.

These changes aim to enhance the precision of float comparisons and ensure consistent behavior across different representations in the system.
This commit is contained in:
Joe 2026-02-19 00:44:16 -06:00
parent 532425df9e
commit 17d52e3edf
6 changed files with 1441 additions and 14 deletions

View file

@ -417,7 +417,7 @@ impl AmbiguousValue {
}
}
fn cleanup_f32(v: f32) -> f32 {
pub(crate) fn cleanup_f32(v: f32) -> f32 {
let cleaned = format!("{:.6}", v).parse::<f32>().unwrap_or(v);
if cleaned == 0.0 {
0.0