Fix IFDRational with a zero denominator

This commit is contained in:
Andrew Murray 2024-10-17 10:58:48 +11:00
parent 5ff20273d9
commit 4611a24661

View File

@ -294,7 +294,7 @@ def _accept(prefix: bytes) -> bool:
def _limit_rational(
val: float | Fraction | IFDRational, max_val: int
) -> tuple[IntegralLike, IntegralLike]:
inv = abs(float(val)) > 1
inv = abs(val) > 1
n_d = IFDRational(1 / val if inv else val).limit_rational(max_val)
return n_d[::-1] if inv else n_d