Skip to content

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Sep 23, 2025

Use the as_integer_ratio() or the numerator and denominator attributes to represent the number as an integer ratio and perform scaling and rounding exactly.

This allows to avoid the precision loss and double rounding error due to conversion to float.


📚 Documentation preview 📚: https://cpython-previews--139273.org.readthedocs.build/

…arguments

Use the as_integer_ratio() or the numerator and denominator attributes
to represent the number as an integer ratio and perform scaling and
rounding exactly.

This allows to avoid the precision loss and double rounding error due to
conversion to float.
@serhiy-storchaka serhiy-storchaka force-pushed the timestamp-timeout-as-integer-ratio branch from 5672976 to 90f8bf2 Compare September 23, 2025 19:38
}


static int
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please document the 3 return values (-1, 0, 1)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants