Learn floating point bugs now or waste time finding them later. This video helps you understand floating point numbers, why they are inaccurate, how they are approximations, and what you can do to prevent floating point bugs. You'll learn why your calculations will often be off by a quick examination of floating point binary, specifically IEEE 754 single precision floating points. But the ideas here apply to double precision floats as well. Floating point number issues are a very common bug to run into and, in my opinion, having a floating point bug is almost a rite of passage for someone who writes code, whether it's in Python, Java, C++, JS, or anything else.
If you like my teaching style, I offer private tutoring:
https://www.codeslatetutoring.com/fro...
References:
What every computer scientist should know about floating point numbers (main source)
https://docs.oracle.com/cd/E19957-01/...
We need rational number with divisor made of powers of 2 to have terminating binary point representation.
https://en.wikipedia.org/wiki/Floatin...
How to deal with floats:
https://softwareengineering.stackexch...