� !A?hl(��.�dZddlmZmZgd�ZGd�de���ZGd�de��Ze�e��Gd �d e��Z e �e ��Gd �d e ��Z Gd �de ��Z e �e ��dS)z~Abstract Base Classes (ABCs) for numbers, according to PEP 3141. TODO: Fill out more detailed documentation on the operators.�)�ABCMeta�abstractmethod)�Number�Complex�Real�Rational�Integralc��eZdZdZdZdZdS)rz�All numbers inherit from this class. If you just want to check if an argument x is a number, without caring what kind, use isinstance(x, Number). �N)�__name__� __module__� __qualname__�__doc__� __slots__�__hash__r ��4/opt/alt/python-internal/lib64/python3.11/numbers.pyrr s&�������� �I��H�H�Hrr)� metaclassc��eZdZdZdZed���Zd�Zeed�����Z eed�����Z ed���Z ed���Z ed ���Z ed ���Zd �Zd �Zed ���Zed���Zed���Zed���Zed���Zed���Zed���Zed���Zed���ZdS)rafComplex defines the operations that work on the builtin complex type. In short, those are: a conversion to complex, .real, .imag, +, -, *, /, **, abs(), .conjugate, ==, and !=. If it is given heterogeneous arguments, and doesn't have special knowledge about them, it should fall back to the builtin complex type as described below. r c��dS)zr rc��t�)z self + otherr�r�others r�__add__zComplex.__add__G� ��"�!rc��t�)z other + selfrr$s r�__radd__zComplex.__radd__Lr'rc��t�)z-selfrrs r�__neg__zComplex.__neg__Qr'rc��t�)z+selfrrs r�__pos__zComplex.__pos__Vr'rc��|| zS)z self - otherr r$s r�__sub__zComplex.__sub__[s���u�f�}�rc��| |zS)z other - selfr r$s r�__rsub__zComplex.__rsub___s���u�u�}�rc��t�)z self * otherrr$s r�__mul__zComplex.__mul__cr'rc��t�)z other * selfrr$s r�__rmul__zComplex.__rmul__hr'rc��t�)z5self / other: Should promote to float when necessary.rr$s r� __truediv__zComplex.__truediv__mr'rc��t�)z other / selfrr$s r� __rtruediv__zComplex.__rtruediv__rr'rc��t�)zBself**exponent; should promote to float or complex when necessary.r)r�exponents r�__pow__zComplex.__pow__wr'rc��t�)z base ** selfr)r�bases r�__rpow__zComplex.__rpow__|r'rc��t�)z7Returns the Real distance from 0. Called for abs(self).rrs r�__abs__zComplex.__abs__�r'rc��t�)z$(x+y*i).conjugate() returns (x-y*i).rrs r� conjugatezComplex.conjugate�r'rc��t�)z self == otherrr$s r�__eq__zComplex.__eq__�r'rN)r r rrrrrr�propertyrr"r&r)r+r-r/r1r3r5r7r9r<r?rArCrEr rrrr s���������I��K�K��^�K������"�"��^��X�"���"�"��^��X�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��������"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"�"�"rrc�N�eZdZdZdZed���Zed���Zed���Zed���Z edd���Z d �Z d �Z ed ���Z ed ���Zed ���Zed���Zed���Zed���Zd�Zed���Zed���Zd�ZdS)rz�To Complex, Real adds the operations that work on real numbers. In short, those are: a conversion to float, trunc(), divmod, %, <, <=, >, and >=. Real also provides defaults for the derived operations. r c��t�)zTAny Real can be converted to a native float object. Called for float(self).rrs r� __float__zReal.__float__�� �� "�!rc��t�)aGtrunc(self): Truncates self to an Integral. Returns an Integral i such that: * i>0 iff self>0; * abs(i) <= abs(self); * for any Integral j satisfying the first two conditions, abs(i) >= abs(j) [i.e. i has "maximal" abs among those]. i.e. "truncate towards 0". rrs r� __trunc__zReal.__trunc__�s ��"�!rc��t�)z$Finds the greatest Integral <= self.rrs r� __floor__zReal.__floor__�r'rc��t�)z!Finds the least Integral >= self.rrs r�__ceil__z Real.__ceil__�r'rNc��t�)z�Rounds self to ndigits decimal places, defaulting to 0. If ndigits is omitted or None, returns an Integral, otherwise returns a Real. Rounds half toward even. r)r�ndigitss r� __round__zReal.__round__�r rc��||z||zfS)z�divmod(self, other): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations. r r$s r� __divmod__zReal.__divmod__�s�� �� �t�e�|�,�,rc��||z||zfS)z�divmod(other, self): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations. r r$s r� __rdivmod__zReal.__rdivmod__�s�� �� �u�t�|�,�,rc��t�)z)self // other: The floor() of self/other.rr$s r� __floordiv__zReal.__floordiv__�r'rc��t�)z)other // self: The floor() of other/self.rr$s r� __rfloordiv__zReal.__rfloordiv__�r'rc��t�)z self % otherrr$s r�__mod__z Real.__mod__�r'rc��t�)z other % selfrr$s r�__rmod__z Real.__rmod__�r'rc��t�)zRself < other < on Reals defines a total ordering, except perhaps for NaN.rr$s r�__lt__z Real.__lt__�rJrc��t�)z self <= otherrr$s r�__le__z Real.__le__�r'rc�:�tt|����S)z(complex(self) == complex(float(self), 0))�complex�floatrs rrzReal.__complex__�s���u�T�{�{�#�#�#rc��| S)z&Real numbers are their real component.r rs rrz Real.real�� ���u� rc��dS)z)Real numbers have no imaginary component.rr rs rr"z Real.imag�� ���qrc��| S)zConjugate is a no-op for Reals.r rs rrCzReal.conjugates ���u� r�N)r r rrrrrIrLrNrPrSrUrWrYr[r]r_rarcrrFrr"rCr rrrr�s����������I��"�"��^�"� � "� "��^� "��"�"��^�"��"�"��^�"��"�"�"��^�"�-�-�-�-�-�-��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"� �"�"��^�"� $�$�$�����X������X������rrc�h�eZdZdZdZeed�����Zeed�����Zd�Z dS)rz6.numerator and .denominator should be in lowest terms.r c��t�rlrrs r� numeratorzRational.numeratorr'rc��t�rlrrs r� denominatorzRational.denominatorr'rc�T�t|j��t|j��z S)a float(self) = self.numerator / self.denominator It's important that this conversion use the integer's "true" division rather than casting one side to float before dividing so that ratios of huge integers convert without overflowing. )�introrqrs rrIzRational.__float__s$���4�>�"�"�S��)9�%:�%:�:�:rN) r r rrrrFrrorqrIr rrrr sv������@�@��I� ��"�"��^��X�"���"�"��^��X�"�;�;�;�;�;rrc�n�eZdZdZdZed���Zd�Zedd���Zed���Z ed���Z ed ���Z ed ���Z ed ���Z ed ���Zed ���Zed���Zed���Zed���Zed���Zd�Zed���Zed���ZdS)r z�Integral adds methods that work on integral numbers. In short, these are conversion to int, pow with modulus, and the bit-string operations. r c��t�)z int(self)rrs r�__int__zIntegral.__int__/r'rc� �t|��S)z6Called whenever an index is needed, such as in slicing)rsrs r� __index__zIntegral.__index__4s���4�y�y�rNc��t�)a4self ** exponent % modulus, but maybe faster. Accept the modulus argument if you want to support the 3-argument version of pow(). Raise a TypeError if exponent < 0 or any argument isn't Integral. Otherwise, just implement the 2-argument version described in Complex. r)rr;�moduluss rr<zIntegral.__pow__8s ��"�!rc��t�)z self << otherrr$s r� __lshift__zIntegral.__lshift__Cr'rc��t�)z other << selfrr$s r� __rlshift__zIntegral.__rlshift__Hr'rc��t�)z self >> otherrr$s r� __rshift__zIntegral.__rshift__Mr'rc��t�)z other >> selfrr$s r� __rrshift__zIntegral.__rrshift__Rr'rc��t�)z self & otherrr$s r�__and__zIntegral.__and__Wr'rc��t�)z other & selfrr$s r�__rand__zIntegral.__rand__\r'rc��t�)z self ^ otherrr$s r�__xor__zIntegral.__xor__ar'rc��t�)z other ^ selfrr$s r�__rxor__zIntegral.__rxor__fr'rc��t�)z self | otherrr$s r�__or__zIntegral.__or__kr'rc��t�)z other | selfrr$s r�__ror__zIntegral.__ror__pr'rc��t�)z~selfrrs r� __invert__zIntegral.__invert__ur'rc�:�tt|����S)zfloat(self) == float(int(self)))rfrsrs rrIzIntegral.__float__{s���S��Y�Y���rc��| S)z"Integers are their own numerators.r rs rrozIntegral.numeratorrhrc��dS)z!Integers have a denominator of 1.�r rs rrqzIntegral.denominator�rjrrl)r r rrrrrvrxr<r|r~r�r�r�r�r�r�r�r�r�rIrFrorqr rrr r &s��������� �I��"�"��^�"�����"�"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"��"�"��^�"�  � � �����X������X���rr N)r�abcrr�__all__rr�registerrerrfrr rsr rr�r�sn��@�@�(�'�'�'�'�'�'�'� ?� ?� ?�� � � � � �w� � � � �(n"�n"�n"�n"�n"�f�n"�n"�n"�`�������s�s�s�s�s�7�s�s�s�j� � �e����;�;�;�;�;�t�;�;�;�6a�a�a�a�a�x�a�a�a�F ���#�����r