Why do 0.1 and 1/10 work but 0.3-0.2 doesn't?

  • Python
  • Thread starter SamRoss
  • Start date
  • Tags
    Work
In summary: It is worse than I thought:>>> print(0.3-0.2)0.09999999999999998What is this awful precision?What do you expect ##0.1 - 2^{-55}## to look like?If you want to reduce precision you can do that yourself using either Math.round or sigfig.round as appropriate.
  • #106
anorlunda said:
Haven't we flogged this topic to death yet?
I think it's machine esilon away from death and, due to finite precision arithmetic, it always will be...
 
  • Like
  • Haha
Likes vela and jbriggs444
Technology news on Phys.org
  • #108
After moderator review, the thread will remain closed as the topic has been sufficiently discussed and the OP is long gone. Thanks to all who participated!
 
  • Like
Likes scottdave

Similar threads

Replies
5
Views
1K
Replies
7
Views
2K
Replies
3
Views
1K
Replies
5
Views
3K
Replies
29
Views
2K
Replies
3
Views
693
Replies
5
Views
2K
Replies
2
Views
1K
Back
Top