For large numbers, the precision is low that is why one is True
, the other is False
, if you try with a smaller number, you will see that both will evaluate to be True
:
>>> math.pow(10,15)
1000000000000000.0
>>> 10**15
1000000000000000
>>> math.pow(10,15)==10**15
True
>>> math.pow(10,20)
1e+20
>>> 10**20
100000000000000000000
>>> math.pow(10,20) == 10**20
True
But if you look at some larger numbers represented by exponent:
>>> math.pow(10,50)
1e+50
>>>10**50
100000000000000000000000000000000000000000000000000
>>> math.pow(10,50)==10**50
False
If you try to convert it to integer, you'll see that the number just changes:
>>> int(math.pow(10,50))
100000000000000007629769841091887003294964970946560