How to represent irrational numbers in Python?
e.g. I need sqrt(2) * sqrt(2) to be 2 (or 2.0)
But:
>>> sqrt(2) * sqrt(2)
2.0000000000000004
Same with floating point:
>>> sqrt(2.0) * sqrt(2.0)
2.0000000000000004
Decimal too:
>>> Decimal(2).sqrt() * Decimal(2).sqrt()
Decimal('1.999999999999999999999999999')