Created
September 6, 2019 07:51
-
-
Save rkennesson/c7af72e2f0fcb3c23c18dd2726a2a497 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def my_round(x, prec=2, base=0.05): return (base * (np.array(x) / base).round()).round(prec) |
x // base * base
math.ceil((math.floor(math.log(256,2)+1))/8)*8
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For rounding to non-integer values, such as 0.05:
def myround(x, prec=2, base=.05):
return round(base * round(float(x)/base),prec)
I found