Python rounding error with float numbers [duplicate]

Any number that can’t be built from exact powers of two can’t be represented exactly as a floating point number; it needs to be approximated. Sometimes the closest approximation will be less than the actual number.

Read What Every Computer Scientist Should Know About Floating-Point Arithmetic.

Leave a Comment