eugene
eugene

Reputation: 41785

python, multiply power of 10 in, strange number

(Pdb) int(math.pow(10, num_digits))
100000000000000005366162204393472
(Pdb) num_digits
32

When num_digits are big numbers, something is messed up..

Upvotes: 0

Views: 581

Answers (1)

Axeltherabbit
Axeltherabbit

Reputation: 753

If you want pow with integers use **

n**32

math.pow uses a float

an explanation about the implementation can be found here : How did Python implement the built-in function pow()?

Upvotes: 1

Related Questions