https://github.com/sublee/almost
A helper to compare two numbers generously.
https://github.com/sublee/almost
Last synced: about 1 month ago
JSON representation
A helper to compare two numbers generously.
- Host: GitHub
- URL: https://github.com/sublee/almost
- Owner: sublee
- License: other
- Created: 2013-01-08T10:00:09.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-03-06T10:14:06.000Z (over 13 years ago)
- Last Synced: 2026-04-04T18:14:53.474Z (3 months ago)
- Language: Python
- Size: 137 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
Almost
~~~~~~
A helper to compare two numbers generously.
::
from almost import almost
def test_repeating_decimal():
assert almost(1 / 3.) == 0.333
assert almost(1 / 6.) == 0.167
assert almost(3227 / 555., precision=6) == 5.814414
def test_irrational_number():
import math
assert almost(math.pi) == 3.142
assert almost(math.sqrt(2)) == 1.414