+
    i-  c                   s    R t ^ RIHtHt . ROt ! R R]R7      t ! R	 R]4      t]P                  ]4        ! R
 R]4      t	]	P                  ]
4        ! R R]	4      t ! R R]4      t]P                  ]4       R# )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                   s"    ] tR t^%tRtRtRtRtR# )r   zAll 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____firstlineno____doc__	__slots__Z__hash____static_attributes__r        /usr/lib64/python3.14/numbers.pyr   r   %   s    
 I Hr   )Z	metaclassc                   sN  a  ] tR t^9t o RtRt]R 4       tR t]	]R 4       4       t
]	]R 4       4       t]R 4       t]R 4       t]R 4       t]R	 4       tR
 tR t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       tRtV tR# )r   aN  Complex 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.
c                s    R# )z<Return a builtin complex instance. Called for complex(self).Nr   self   &r   __complex__ZComplex.__complex__F   s    r   c                s    V ^ 8g  # )z)True if self != 0. Called for bool(self).r   r   r   r   __bool__ZComplex.__bool__J   s    qyr   c                    \         h)zHRetrieve the real component of this number.

This should subclass Real.
ZNotImplementedErrorr   r   r   realZComplex.realN   
     "!r   c                r   )zMRetrieve the imaginary component of this number.

This should subclass Real.
r   r   r   r   imagZComplex.imagW   r   r   c                r   )zself + otherr   r   Zother   &&r   __add__ZComplex.__add__`   
     "!r   c                r   )zother + selfr   r   r   r   __radd__ZComplex.__radd__e   r   r   c                r   )z-selfr   r   r   r   __neg__ZComplex.__neg__j   r   r   c                r   )z+selfr   r   r   r   __pos__ZComplex.__pos__o   r   r   c                s    W) ,           # )zself - otherr   r   r   r   __sub__ZComplex.__sub__t   s    f}r   c                s    V ) V,           # )zother - selfr   r   r   r   __rsub__ZComplex.__rsub__x   s    uu}r   c                r   )zself * otherr   r   r   r   __mul__ZComplex.__mul__|   r   r   c                r   )zother * selfr   r   r   r   __rmul__ZComplex.__rmul__   r   r   c                r   )z5self / other: Should promote to float when necessary.r   r   r   r   __truediv__ZComplex.__truediv__   r   r   c                r   )zother / selfr   r   r   r   __rtruediv__ZComplex.__rtruediv__   r   r   c                r   )zDself ** exponent; should promote to float or complex when necessary.r   )r   exponentr   r   __pow__ZComplex.__pow__   r   r   c                r   )zbase ** selfr   )r   Zbaser   r   __rpow__ZComplex.__rpow__   r   r   c                r   )z7Returns the Real distance from 0. Called for abs(self).r   r   r   r   __abs__ZComplex.__abs__   r   r   c                r   )z$(x+y*i).conjugate() returns (x-y*i).r   r   r   r   	conjugateZComplex.conjugate   r   r   c                r   )zself == otherr   r   r   r   __eq__ZComplex.__eq__   r   r   r   N)r   r	   r
   r   r   r   r   r   r   propertyr   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r)   r*   r+   r,   r-   r   __classdictcell__Z__classdict__   @r   r   r   9   sp     IK K "  " "  " " " " " " " " " " " " " " " " " " " " " " " " " " "r   c                   s  a  ] tR t^t o RtRt]R 4       t]R 4       t]R 4       t	]R 4       t
]RR l4       tR tR	 t]R
 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       tR t]R 4       t]R 4       tR tRtV tR# )r   zTo 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.
c                r   )zLAny Real can be converted to a native float object.

Called for float(self).r   r   r   r   	__float__ZReal.__float__   
    
 "!r   c                r   )a  trunc(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".
r   r   r   r   	__trunc__ZReal.__trunc__   s
     "!r   c                r   )z$Finds the greatest Integral <= self.r   r   r   r   	__floor__ZReal.__floor__   r   r   c                r   )z!Finds the least Integral >= self.r   r   r   r   __ceil__ZReal.__ceil__   r   r   Nc                r   )zRounds 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   Zndigitsr   r   	__round__ZReal.__round__   r   r   c                s"    W,          W,          3# )zdivmod(self, other): The pair (self // other, self % other).

Sometimes this can be computed faster than the pair of
operations.
r   r   r   r   
__divmod__ZReal.__divmod__   s     t|,,r   c                s"    W,          W,          3# )zdivmod(other, self): The pair (other // self, other % self).

Sometimes this can be computed faster than the pair of
operations.
r   r   r   r   __rdivmod__ZReal.__rdivmod__   s     u|,,r   c                r   )z)self // other: The floor() of self/other.r   r   r   r   __floordiv__ZReal.__floordiv__   r   r   c                r   )z)other // self: The floor() of other/self.r   r   r   r   __rfloordiv__ZReal.__rfloordiv__   r   r   c                r   )zself % otherr   r   r   r   __mod__ZReal.__mod__   r   r   c                r   )zother % selfr   r   r   r   __rmod__ZReal.__rmod__   r   r   c                r   )zJself < other

< on Reals defines a total ordering, except perhaps for NaN.r   r   r   r   __lt__ZReal.__lt__  r3   r   c                r   )zself <= otherr   r   r   r   __le__ZReal.__le__	  r   r   c                *    \        \        V 4      4      # )z(complex(self) == complex(float(self), 0))complexfloatr   r   r   r   ZReal.__complex__  s    uT{##r   c                    V 5# )z&Real numbers are their real component.r   r   r   r   r   Z	Real.real       ur   c                s    ^ # )z)Real numbers have no imaginary component.r   r   r   r   r   Z	Real.imag       r   c                rC   )zConjugate is a no-op for Reals.r   r   r   r   r,   ZReal.conjugate  s	    ur   r   N)r   r	   r
   r   r   r   r   r2   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r   r.   r   r   r,   r   r/   r0   r1   r   r   r      s,     I" " 
" 
" " " " " " "-- " " " " " " " " " " " "
$     r   c                   sb   a  ] tR tRt o RtRt]]R 4       4       t]]R 4       4       t	R t
RtV tR# )r   i$  zTo Real, Rational adds numerator and denominator properties.

The numerator and denominator values should be in lowest terms,
with a positive denominator.
c                r   )z3The numerator of a rational number in lowest terms.r   r   r   r   	numeratorZRational.numerator-  s
     "!r   c                r   )z\The denominator of a rational number in lowest terms.

This denominator should be positive.
r   r   r   r   denominatorZRational.denominator3  r   r   c                s`    \        V P                  4      \        V P                  4      ,          # )zfloat(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.

)intrG   rH   r   r   r   r2   ZRational.__float__=  s#     4>>"S)9)9%:::r   r   N)r   r	   r
   r   r   r   r.   r   rG   rH   r2   r   r/   r0   r1   r   r   r   $  sQ      I"  " "  "; ;r   c                   s(  a  ] tR tRt o RtRt]R 4       tR t]RR l4       t	]R 4       t
]R 4       t]R	 4       t]R
 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       tR t]R 4       t]R 4       tRtV tR# )r   iH  zIntegral adds methods that work on integral numbers.

In short, these are conversion to int, pow with modulus, and the
bit-string operations.
c                r   )z	int(self)r   r   r   r   __int__ZIntegral.__int__Q  r   r   c                s    \        V 4      # )z6Called whenever an index is needed, such as in slicing)rI   r   r   r   	__index__ZIntegral.__index__V  s    4yr   Nc                r   )a  self ** 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   )r   r(   Zmoduluss   &&&r   r)   ZIntegral.__pow__Z  s
     "!r   c                r   )zself << otherr   r   r   r   
__lshift__ZIntegral.__lshift__e  r   r   c                r   )zother << selfr   r   r   r   __rlshift__ZIntegral.__rlshift__j  r   r   c                r   )zself >> otherr   r   r   r   
__rshift__ZIntegral.__rshift__o  r   r   c                r   )zother >> selfr   r   r   r   __rrshift__ZIntegral.__rrshift__t  r   r   c                r   )zself & otherr   r   r   r   __and__ZIntegral.__and__y  r   r   c                r   )zother & selfr   r   r   r   __rand__ZIntegral.__rand__~  r   r   c                r   )zself ^ otherr   r   r   r   __xor__ZIntegral.__xor__  r   r   c                r   )zother ^ selfr   r   r   r   __rxor__ZIntegral.__rxor__  r   r   c                r   )zself | otherr   r   r   r   __or__ZIntegral.__or__  r   r   c                r   )zother | selfr   r   r   r   __ror__ZIntegral.__ror__  r   r   c                r   )z~selfr   r   r   r   
__invert__ZIntegral.__invert__  r   r   c                r@   )zfloat(self) == float(int(self)))rB   rI   r   r   r   r2   ZIntegral.__float__  s    SYr   c                rC   )z"Integers are their own numerators.r   r   r   r   rG   ZIntegral.numerator  rD   r   c                s    ^# )z!Integers have a denominator of 1.r   r   r   r   rH   ZIntegral.denominator  rE   r   r   rF   )r   r	   r
   r   r   r   r   rJ   rK   r)   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   r2   r.   rG   rH   r   r/   r0   r1   r   r   r   H  sE     I" " " " " " " " " " " " " " " " " " " " " " " " " "
     r   N)r   r   r   r   r   )r   Zabcr    r   Z__all__r   r   ZregisterrA   r   rB   r   r   rI   r   r   r   <module>rW      s   @: (
?	w 	(n"f n"`    s7 sj e !;t !;Hax aF 	  # r   