Floating Point Imprecision

What is Floating point imprecision?

These two expressions in python are suppose to produce the same result. But why don't they do that?

>>> 7 / 3 * 3
7.0

>>> 1 / 3 * 7 * 3
6.999999999999999

When should you be careful about floating point imprecision?

Did you find this post useful? Show some love!
Classic DEV Post from Apr 21

What is a website that you visit regularly despite its technical quality and user experience?

You want the website to be better because you want the service they are providi...

READ POST
Follow @ben to see more of their posts in your feed.
Mayemene Fomene Jean Vladimir
Member since May 7, 2018
Trending on dev.to
How to get a job?
#help #career
What was your worst experience with a programming language?
#discuss #programming #python #experience
[Web] Your download will start in a few seconds...
#help #web
How to Set up a Twitter Bot with Python and Heroku
#python #heroku #flask #twitter
How to start machine learning with Keras (Windows)
#machinelearning #python #beginners
Saying "Hello world" using Masonite Framework
#python #framework #masonite
Masonite Python Framework Knowledge Series: Part 1 - Understanding Auto Resolving Dependency Injection
#python #programming #framework #masonite
Resources for Getting into DevOps?
#help #discuss #devops