Why is different ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why is different ??

a = 9**16 == int(float(9**16)) b = 9**17 == int(float(9**17)) print (a) print (b) https://code.sololearn.com/cm7U8i3B0SSf/?ref=app

1st Jun 2020, 12:29 PM
Epic Coder
Epic Coder - avatar
1 Answer
+ 5
Floating-point numbers are represented with certain precision only. For most cases this doesn't make a difference, but for large-scale operations like exponentiation, it might be off to some extent. Read more: https://en.m.wikipedia.org/wiki/Floating-point_arithmetic#Accuracy_problems
1st Jun 2020, 12:53 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar