Why is <code>if (0.1 + 0.2 == 0.3)</code> unreliable?
- A
Always works
- Bcheck_circle
Round-off error in floating-point representation
- C
0.1 isn't a valid number
- D
Doubles can't be compared
Explanation
Binary FP cannot represent 0.1 exactly; 0.1+0.2 = 0.30000000000000004.