When compiling the following on my raspberry pi v2:
fn main() {
let expected = 0.09375f64;
println!("EXPECTED: {:?}", expected);
}
the compiled program prints: EXPECTED: 0. Can someone explain to me why?
The architecture is:
$ uname -m
armv7l
... with further exploration:
fn main() {
let expected = 100f32;
println!("EXPECTED: {}", expected);
let expected = 100f64;
println!("EXPECTED: {}", expected);
let expected = 100.0;
println!("EXPECTED: {}", expected);
}
prints:
EXPECTED: 0.00000000000000000000000000000000000000000014
EXPECTED: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000494
EXPECTED: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000494
Is there something about the arm architecture that does not understand f32 and f64 types?