Skip to content

Commit 8adbea3

Browse files
Apply ruff/refurb rules (FURB)
FURB163 Prefer `math.log10`/`math.log2` over `math.log` with a redundant base
1 parent 984c895 commit 8adbea3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

numcodecs/quantize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ def encode(self, buf):
6363

6464
# apply scaling
6565
precision = 10.0**-self.digits
66-
exp = math.log(precision, 10)
66+
exp = math.log10(precision)
6767
if exp < 0:
6868
exp = int(math.floor(exp))
6969
else:
7070
exp = int(math.ceil(exp))
71-
bits = math.ceil(math.log(10.0**-exp, 2))
71+
bits = math.ceil(math.log2(10.0**-exp))
7272
scale = 2.0**bits
7373
enc = np.around(scale * arr) / scale
7474

0 commit comments

Comments
 (0)