projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup.
[python_utils.git]
/
math_utils.py
diff --git
a/math_utils.py
b/math_utils.py
index 3216d4a9222f3e9760d2f5276b40503e08cfee8f..37fcec5f6c557cdf1a66d39b671fd8d9438ba29c 100644
(file)
--- a/
math_utils.py
+++ b/
math_utils.py
@@
-1,9
+1,11
@@
#!/usr/bin/env python3
#!/usr/bin/env python3
+"""Mathematical helpers."""
+
import functools
import math
import functools
import math
+from heapq import heappop, heappush
from typing import List
from typing import List
-from heapq import heappush, heappop
class RunningMedian(object):
class RunningMedian(object):
@@
-76,8
+78,8
@@
def truncate_float(n: float, decimals: int = 2):
3.141
"""
3.141
"""
- assert
decimals > 0 and
decimals < 10
- multiplier = 10
**
decimals
+ assert
0 <
decimals < 10
+ multiplier = 10
**
decimals
return int(n * multiplier) / multiplier
return int(n * multiplier) / multiplier