mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
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:
parent
532425df9e
commit
17d52e3edf
6 changed files with 1441 additions and 14 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue