Skip to main content

rounding

Rounding methods

StandardRound rounds to the nearest, and in the event of a tie, rounds up.

RoundToEven rounds to the nearest, but in the event of a tie, rounds toward the nearest even number.

StochasticRound provides a mechanism to eliminate accumulated roundoff error in the presence of a distribution where for individual samples, the roundoff error is skewed. This is typically caused by small values. This may be a common problem when dealing with applying a function to many small integer values as the number of discreet inputs is small.

One drawback to stochastic rounding is the output is non-deterministic, but this can be avoided by providing a custom deterministic generator, or invoking providing the random number generator with a fixed seed.

r = random.Random()
r.seed(123)
sr = StochasticRound(precision=0, random_generator=r)

Metadata

Release files for rounding 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rounding 0.4
File Size Uploaded Provenance Actions
rounding-0.4.tar.gz 2.8 kB Without provenance Details for rounding-0.4.tar.gz

Release files / rounding-0.4.tar.gz

Download URL rounding-0.4.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a71f3bd0d67558b0e71eb65c870c4ca9bb8f7c85f1607715f4197d010dc3968f
BLAKE2b-256 checksum
How to use checksums
a1ebeda05aec16c32631a4a66711e697fccfb9267ee11bf16dd90a0567087a6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for rounding 0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page