Is there an equivalent to C++17 floating point literals using 0x...p...
? E.g. 0x1p-64
...
1 Like
I assume I can replace it by:
// 0x1p-64 = (2.0 as f32).powi(-64 as i32)
let x = (2.0 as f32).powi(-64 as i32)
That calculation only works in simple cases, when all the intermediate values can be represented exactly. The hexf crate offers exact hex literals, and they're evaluated at compile time to boot.
3 Likes