In [1]:
from ahh import ext
import numpy as np
In [2]:
x = 3
ext.round_to(x, base=2) # round to nearest 2
x = 234
ext.round_to(x, base=5) # round to closest 5
x = 239
ext.round_to(x, base=5) # round to closest 5
x = 34
ext.round_to(x, base=10) # round to nearest 10
x = 9
ext.round_to(x, base=10) # round to nearest 10
Out[2]:
Out[2]:
Out[2]:
Out[2]:
Out[2]:
In [3]:
x = 12
oom = ext.get_order_mag(x) # order of magnitude
oom, np.power(10, oom)
x = 125
oom = ext.get_order_mag(x)
oom, np.power(10, oom)
x = 1
oom = ext.get_order_mag(x)
oom, np.power(10, oom)
Out[3]:
Out[3]:
Out[3]:
In [ ]: