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

  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
7
Views
552
  • Programming and Computer Science
Replies
5
Views
3K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
8
Views
912
  • Programming and Computer Science
Replies
17
Views
2K
  • Programming and Computer Science
Replies
11
Views
829
Back
Top