Do you mean this example? (it's the only one I can find about floating point comparison)
> 2.2 * 3.0 == 3.3 * 2.0
It's definitely due to accuracy error. (rather than type comparison) How would you explain it otherwise?
Do you mean this example? (it's the only one I can find about floating point comparison)
> 2.2 * 3.0 == 3.3 * 2.0
It's definitely due to accuracy error. (rather than type comparison) How would you explain it otherwise?
And you're completely right there. Any language using floating-point numbers will have the same issue regardless of its typing discipline e.g. Rust: https://is.gd/4BNoWa
>>> float > float('infinity')
TrueBasically, autoconvert the above to this (and make Fraction a builtin instead of in the standard library, of course):
>>> Fraction('2.2') * Fraction('3.0') == Fraction('3.3') * Fraction('2.0')
TrueAlso, I think that '2.2' is better represented as `Decimal`, as it's a decimal number (which is a subset of rational numbers, that are usually better represented using `Decimal`) (edit: that of course depends on the use case, as Decimal uses fixed-point precision).