Skip to content

Commit

Permalink
Apply ruff/refurb rules (FURB)
Browse files Browse the repository at this point in the history
FURB163 Prefer `math.log10`/`math.log2` over `math.log` with a redundant base
  • Loading branch information
DimitriPapadopoulos committed Sep 16, 2024
1 parent 52d220f commit e133290
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions numcodecs/quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ def encode(self, buf):

# apply scaling
precision = 10.0**-self.digits
exp = math.log(precision, 10)
exp = math.log10(precision)
if exp < 0:
exp = int(math.floor(exp))
else:
exp = int(math.ceil(exp))
bits = math.ceil(math.log(10.0**-exp, 2))
bits = math.ceil(math.log2(10.0**-exp))
scale = 2.0**bits
enc = np.around(scale * arr) / scale

Expand Down

0 comments on commit e133290

Please sign in to comment.