/autorounddecimal

auto round decimal in python and hy

Primary LanguageHy

autorounddecimal

Build Status Downloads Version

auto round decimal

Usage

python

from autorounddecimal.core import adround

adround(0.00032001)     ;;=> 0.00032001
adround(0.0003200001)   ;;=> 0.00032
adround(0.000319999)    ;;=> 0.00032


adround(3.2001)     ;;=> 3.2001
adround(3.200001)   ;;=> 3.2
adround(3.19999)    ;;=> 3.2

adround(3.20000123)               ;;=> 3.2
adround(3.20000123, min_count=4)   ;;=> 3.2
adround(3.20000123, min_count=5)   ;;=> 3.20000123
adround(3.200000123, min_count=5)   ;;=> 3.2
adround(3.200000123, min_count=6)   ;;=> 3.200000123

Installation

$ pip install autorounddecimal