from decimal import Decimal # Should report error as we are comparing FLOAT to DECIMAL that are DIFFERENT TYPES print("Content of Object1 is: " +str(x)+" ("+str(type(x))+")") print("Content of Object2 is: " +str(y)+" ("+str(type(y))+")") try: x = Decimal("1111111111.0500") y = 1111111111.0500 if y > x: print("WRONG: FLOAT is detected as same as DECIMAL") else: print("WRONG: FLOAT seems comparable with DECIMAL") except Exception as e: print("CORRECT: FLOAT is NOT comparable with DECIMAL") # Output: # Python 2.6.5 32bit -- WRONG: FLOAT seems comparable with DECIMAL (WRONG) # Python 2.7.2 32bit -- WRONG: FLOAT seems comparable with DECIMAL (WRONG) # Python 3.1.2 32bit -- CORRECT: FLOAT is NOT comparable with DECIMAL (CORRECT) # Python 3.4.0 ([GCC 4.8.2] on linux) 32bit -- WRONG: FLOAT seems comparable with DECIMAL (WRONG)