Solution
This is a known problem in numerical mathematics. Therefore, it is expected in all programming languages. Because most floating-point numbers (DBLs) do not have exact binary representations, comparing them for equality can yield unexpected results.
DBLs are represented internally as a binary approximation, causing calculations that would be exact in decimal notation to often be inexact in binary because small rounding errors occur in the outer decimal places of the values. For example, a computer can and will often compare 0.1 + 0.2 = 0.3 as false, as the binary representation of the equation's both sides could execute to a value only close to the exact value like e.g. 0.3000000000044 (or any number of similar rounded-off variants depending on the machine and compilation order), rendering the equality false.

To avoid this, when using comparison logic with floating-point values, use one of the following methods:
- Compare for "greater or equal" or "less or equal" instead for "equal".
- Compare while allowing an absolute difference (absolute epsilon).
- Compare to within relative epsilon.
- Compare to within a given digit of precision by converting the numbers to strings.
- Compare using integers.