Hi guys, thanks for coming in!!
I met a problem about the change of float's accuracy in module.
I simply put lines below in a .py file, and execute it in commend line.
def main():
i = 1.12345678901234567890
print i
if __name__ == "__main__":
main()
But the result is surprisingly 1.12345678901, instead of 1.1234567890123457. I'm quite surprised, since if I input
>>> i = 1.12345678901234567890
>>> print i
in commend line, the result would be 1.1234567890123457. I know the accuracy of float in python is 15.
So I'm totally lost, why does this happen?
I met a problem about the change of float's accuracy in module.
I simply put lines below in a .py file, and execute it in commend line.
def main():
i = 1.12345678901234567890
print i
if __name__ == "__main__":
main()
But the result is surprisingly 1.12345678901, instead of 1.1234567890123457. I'm quite surprised, since if I input
>>> i = 1.12345678901234567890
>>> print i
in commend line, the result would be 1.1234567890123457. I know the accuracy of float in python is 15.
So I'm totally lost, why does this happen?
Last edited: