()
| 253 | |
| 254 | #[test] |
| 255 | fn test_to_hex() { |
| 256 | use rand::Rng; |
| 257 | for _ in 0..20000 { |
| 258 | let bytes = rand::rng().random::<u64>(); |
| 259 | let f = f64::from_bits(bytes); |
| 260 | if !f.is_finite() { |
| 261 | continue; |
| 262 | } |
| 263 | let hex = to_hex(f); |
| 264 | // println!("{} -> {}", f, hex); |
| 265 | let roundtrip = hexf_parse::parse_hexf64(&hex, false).unwrap(); |
| 266 | // println!(" -> {}", roundtrip); |
| 267 | assert!(f == roundtrip, "{f} {hex} {roundtrip}"); |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | #[test] |
| 272 | fn test_remove_trailing_zeros() { |