brep_render/formatting.rs
1//! Numeric formatting shared by annotations and app panels.
2
3/// Fixed precision without trailing fractional zeros. Preserves signed zero;
4/// callers that use the result as an identifier may choose to normalize it.
5pub fn compact_decimal(value: f64, precision: usize) -> String {
6 let text = format!("{value:.precision$}");
7 if precision == 0 {
8 return text;
9 }
10 text.trim_end_matches('0').trim_end_matches('.').to_string()
11}
12
13// BREP private tests: b3f46d2fc2bf6451