Floating point problem
On 18/04/2020 15:29, Grant Edwards wrote:
> On 2020-04-18, Souvik Dutta <souvik.viksou at 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?
> Because computers _don't_do_math_. That is a very important thing to
> Computer do something that _approximates_ math... in some
> situations... if you know what you're doing.
> In you're case you're doing IEEE floating point operations. Before you
> use floating point, you should read the article by Goldman that has been
There is also
In the official Python documentation, well worth reading.