floating-point number
A number with a fractional part, stored approximately.
f32 and f64 are IEEE 754 binary floating-point types; many decimal fractions (0.1) are stored approximately.
Examples
0.1 + 0.2prints0.30000000000000004, so0.1 + 0.2 == 0.3isfalse; compare with(sum - 0.3).abs() < 1e-9instead.
See also