March 20, 2024, 7:43 p.m. | Tom Nijhof

DEV Community dev.to

When working with rounding in Python, you may have come across an unexpected quirk. Unlike most people who tend to round numbers ending in .5 up, Python operates differently. While it rounds 0.5 to 0, it rounds 1.5 to 2, following the international standard (IEEE 754). This may be seen as a feature or a bug, depending on how you view it.






It is a bug, for me!


If you encounter a bug when working with numbers ending …

beginners datascience good ieee international numbers people python standard tutorial

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne

Senior Machine Learning Engineer (MLOps)

@ Promaton | Remote, Europe

Research Scientist, Demography and Survey Science, University Grad

@ Meta | Menlo Park, CA | New York City

Computer Vision Engineer, XR

@ Meta | Burlingame, CA