OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to compare floats for almost-equality in Python?

  • Thread starter Thread starter Gordon Wrigley
  • Start date Start date
G

Gordon Wrigley

Guest
It's well known that comparing floats for equality is a little fiddly due to rounding and precision issues. For examples on this, see the blog post Comparing Floating Point Numbers, 2012 Edition by Bruce Dawson.

How do I deal with this in Python?

Is a standard library function for this available somewhere?
<p>It's well known that comparing floats for equality is a little fiddly due to rounding and precision issues. For examples on this, see the blog post <em><a href="https://web.archive.org/web/2024031...omparing-floating-point-numbers-2012-edition/" rel="nofollow noreferrer">Comparing Floating Point Numbers, 2012 Edition</a></em> by Bruce Dawson.</p>
<p>How do I deal with this in Python?</p>
<p>Is a standard library function for this available somewhere?</p>
 

Latest posts

Top