Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mariogeiger/roundmantissa
https://github.com/mariogeiger/roundmantissa
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/mariogeiger/roundmantissa
- Owner: mariogeiger
- License: mit
- Created: 2022-08-18T17:08:26.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-16T06:37:55.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T05:52:24.657Z (about 1 month ago)
- Language: Python
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
Awesome Lists containing this project
README
`pip install -U roundmantissa`
# roundmantissa
Tiny library :baby_chick: that rounds floating point numbers based on the length of their mantissa.
```
5.0 = 4.0 + 1.0 = (1 + 1/4) * 2**2 = b1.01 * 2**2
``````
round_mantissa(5.0, 0) = b1. * 2**2
round_mantissa(5.0, 1) = b1.0 * 2**2
round_mantissa(5.0, 2) = b1.01 * 2**2
```:hatched_chick: :hatched_chick: :hatched_chick: