Fwd: Can you explain to me this confusion?
---------- Forwarded message --------- Từ: Tung Anh Nguyen <nvta1761999@gmail.com> Date: Th 2, 17 thg 5, 2021 vào lúc 16:34 Subject: Can you explain to me this confusion? To: <python-list@python.org> I'm using Python 3.8.5 on Ubuntu 20.04. I just don't understand these things?
float("8.1")*100 810.0 float("8.2")*100 819.9999999999999 ? float("8.3")*100 830.0000000000001 ? float("8.4")*100 840.0
Why is that? Is that a bug? or something I don't know yet? Could you guys answer my question?
Hi, Le 5/17/21 à 11:37 AM, Tung Anh Nguyen a écrit :
I'm using Python 3.8.5 on Ubuntu 20.04. I just don't understand these things?
float("8.1")*100 810.0 float("8.2")*100 819.9999999999999 ? float("8.3")*100 830.0000000000001 ? float("8.4")*100 840.0
Why is that? Is that a bug? or something I don't know yet? Could you guys answer my question?
We can answer, there's a whole page on the subject on docs.python.org: => https://docs.python.org/3/tutorial/floatingpoint.html and if you want a bit of amusement around this:
import webbrowser webbrowser.open(f"https://{.1+.2}.com")
Bests, -- [Julien Palard](https://mdk.fr)
Cool, thanks! Vào Th 3, 18 thg 5, 2021 vào lúc 14:19 Julien Palard <julien@palard.fr> đã viết:
Hi,
Le 5/17/21 à 11:37 AM, Tung Anh Nguyen a écrit :
I'm using Python 3.8.5 on Ubuntu 20.04. I just don't understand these things?
float("8.1")*100 810.0 float("8.2")*100 819.9999999999999 ? float("8.3")*100 830.0000000000001 ? float("8.4")*100 840.0
Why is that? Is that a bug? or something I don't know yet? Could you guys answer my question?
We can answer, there's a whole page on the subject on docs.python.org:
=> https://docs.python.org/3/tutorial/floatingpoint.html
and if you want a bit of amusement around this:
import webbrowser webbrowser.open(f"https://{.1+.2}.com")
Bests, -- [Julien Palard](https://mdk.fr)
participants (2)
-
Julien Palard
-
Tung Anh Nguyen