Hmm understood. Souvik flutter dev
On Sat, Apr 18, 2020, 7:36 PM Chris Angelico <ros...@gmail.com> wrote: > On Sun, Apr 19, 2020 at 12:03 AM Souvik Dutta <souvik.vik...@gmail.com> > wrote: > > > > I literally tried it!!! And it did not stop because I did not get any 1.0 > > rather I got 0.99999999999 But why does this happen. This is a simple > math > > which according to normal human logic should give perfect numbers which > are > > not endless. Then why does a computer behave so differently? > > > > If you add 0.333 and 0.333 and 0.333, do you get 1.0? No, you get > 0.999. But if you add 1/3 and 1/3 and 1/3, you get 1. The computer has > to round, same as you do - it doesn't have infinite precision. The > truth is that the number 0.1, to a computer, is not actually one tenth > - it's an approximation for one tenth, just as 0.333 is an > approximation for one third. > > ChrisA > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list