0
내 친구를위한 코드를 준비 중이었고이 재미있는 버그/기능을 발견했습니다. 아래의 소스와 출력을보고 누가 나에게 설명 할 수 있습니까? 왜 current_time var에 0.001 이상을 추가합니까?Python이 예상보다 많은 가치를 추가했습니다.
출처 :
import time
current_time = 0.000
check = input("Ready to go?")
while True:
current_time = current_time+0.001
print(str(current_time)+" s")
time.sleep(0.001)
출력 : 사전에
Ready to go?
0.001 s
0.002 s
0.003 s
0.004 s
0.005 s
0.006 s
0.007 s
0.008 s
0.009000000000000001 s
0.010000000000000002 s
0.011000000000000003 s
0.012000000000000004 s
감사합니다!