An open API service indexing awesome lists of open source software.

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.

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