9**19? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

9**19?

a = 9**19 == int(float(9**19)) print(int(a)) Solution: 0 9**19 = was so large I had to use a scientific calculator to find the answer. So float 9**19 would be the same but with a decimal point. They are equal, but neither is a 0, so any ideas? BTW, 9**19=1,350,851,717,672,992,089:).

30th Mar 2019, 10:59 PM
tristach605
tristach605 - avatar
4 Answers
+ 2
You are mistaken in reasoning. float (9 ** 19) = 1, 350 851 717 672 992 e+18; int (float (9 ** 19)) rounds to 1 350 851 717 672 992 000, which means "9 ** 19 == int (float (9 ** 19))" = "false". a = false; int (false) = 0;
31st Mar 2019, 12:25 AM
Solo
Solo - avatar
+ 1
Thanks Vasiliy!
31st Mar 2019, 12:34 AM
tristach605
tristach605 - avatar
0
I just re-read the Python lesson on floats. It mentioned that decimal numbers would be rounded in floats. Do floats also round very large numbers as well?
31st Mar 2019, 12:39 AM
tristach605
tristach605 - avatar
0
If I understand the question correctly, then to understand fractional numbers, can rewrite it like this: float (9 ** 19) = = 1, 350 851 717 672 992 * (e + 18); P.S: "Computers cannot accurately store real numbers, just as we cannot write down all the numbers after the decimal point for the 1/3 equation (0.3333333333333333 ...). Remember this, because it often leads to annoying mistakes!"
31st Mar 2019, 12:51 AM
Solo
Solo - avatar