mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
commit
3134e5cd47
|
@ -310,25 +310,21 @@ class IFDRational(Rational):
|
||||||
float/rational/other number, or an IFDRational
|
float/rational/other number, or an IFDRational
|
||||||
:param denominator: Optional integer denominator
|
:param denominator: Optional integer denominator
|
||||||
"""
|
"""
|
||||||
self._denominator = denominator
|
if isinstance(value, IFDRational):
|
||||||
self._numerator = value
|
self._numerator = value.numerator
|
||||||
self._val = float(1)
|
self._denominator = value.denominator
|
||||||
|
self._val = value._val
|
||||||
|
return
|
||||||
|
|
||||||
if isinstance(value, Fraction):
|
if isinstance(value, Fraction):
|
||||||
self._numerator = value.numerator
|
self._numerator = value.numerator
|
||||||
self._denominator = value.denominator
|
self._denominator = value.denominator
|
||||||
self._val = value
|
else:
|
||||||
|
self._numerator = value
|
||||||
if isinstance(value, IFDRational):
|
self._denominator = denominator
|
||||||
self._denominator = value.denominator
|
|
||||||
self._numerator = value.numerator
|
|
||||||
self._val = value._val
|
|
||||||
return
|
|
||||||
|
|
||||||
if denominator == 0:
|
if denominator == 0:
|
||||||
self._val = float("nan")
|
self._val = float("nan")
|
||||||
return
|
|
||||||
|
|
||||||
elif denominator == 1:
|
elif denominator == 1:
|
||||||
self._val = Fraction(value)
|
self._val = Fraction(value)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user