I am trying to display a f32 in binary format:
let value: f32 = 0.45;
let my_string = format!("{:b}", value);
I get the following error: "the trait bound f32: std::fmt::Binary is not satisfied".
I think we have to implement the trait by ourselves when we want to have a binary representation of a f32 into a String. In fact, Rust doesn't know what to do for some f32 values that cannot be represented in binary. For example, what to do with 0.1 ? Should the trait return the string 0.00011 or 0.0001100110011? Is this the reason why there is no definition of std::fmt::Binary for f32?