g,csOoOOFEoEo+OLoOOXO5oOOX1oXMX1O O X1o X MX 1O O X 1o O OX 1o X MX 1d)z~Abstract Base Classes (ABCs) for numbers, according to PEP 3141. TODO: Fill out more detailed documentation on the operators.)ABCMetaabstractmethod)NumberComplexRealRationalIntegralcs XoOoOoOoOoOoOod)ri%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.pyrr%s IHrr)Z metaclasscsL[XoOoOojOoOoXO1oOoX XO11o X XO11o XO1o XO 1o XO 1oXO 1oO oO oXO1oXO1oXO1oXO1oXO1oXO1oXO1oXO1oXO1oOoQod)ri9aNComplex 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. rcd)z, and >=. Real also provides defaults for the derived operations. rcr)zLAny Real can be converted to a native float object. Called for float(self).rrrr __float__ZReal.__float__ "!rcr)atrunc(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". rrrr __trunc__ZReal.__trunc__s "!rcr)z$Finds the greatest Integral <= self.rrrr __floor__ZReal.__floor__r rcr)z!Finds the least Integral >= self.rrrr__ceil__Z Real.__ceil__r rNcr)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)rZndigitsrr __round__ZReal.__round__rrcsT*T*0!)zdivmod(self, other): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations. rrrr __divmod__ZReal.__divmod__s  t|,,rcsT*T*0!)zdivmod(other, self): The pair (other // self, other % self). Sometimes this can be computed faster than the pair of operations. rrrr __rdivmod__ZReal.__rdivmod__s  u|,,rcr)z)self // other: The floor() of self/other.rrrr __floordiv__ZReal.__floordiv__r rcr)z)other // self: The floor() of other/self.rrrr __rfloordiv__ZReal.__rfloordiv__r rcr)z self % otherrrrr__mod__Z Real.__mod__r rcr)z other % selfrrrr__rmod__Z Real.__rmod__r rcr)zJself < other < on Reals defines a total ordering, except perhaps for NaN.rrrr__lt__Z Real.__lt__r5rcr)z self <= otherrrrr__le__Z Real.__le__ r rc*WWQ11!)z(complex(self) == complex(float(self), 0))complexfloatrrrrZReal.__complex__suT{##rcQ3!)z&Real numbers are their real component.rrrrrZ Real.real u rcr)z)Real numbers have no imaginary component.rrrrrrZ Real.imagrcrE)zConjugate is a no-op for Reals.rrrrr.ZReal.conjugates u rN)r r r r r rrr4r6r7r8r9r:r;r<r=r>r?r@rArr0rrr.rr1r2r3rrrs'I""  " """""""--"""""""""" "" $rrcs`[XoOoOojOoOoXXO11oXXO11o Oo Oo Qo d)ri$z6.numerator and .denominator should be in lowest terms.rcrrHrrrr numeratorZRational.numerator)r rcrrHrrrr denominatorZRational.denominator.r rcsXWQM1WQM1* !)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. )intrIrJrrrr4ZRational.__float__4s#4>>"S)9)9%:::rN) r r r r r rr0rrIrJr4rr1r2r3rrr$sH@I """";rrcs&[XoOoOojOoOoXO1oOoXOOg1o XO1o XO 1o XO 1o XO 1o XO 1oXO 1oXO1oXO1oXO1oXO1oXO1oOoXO1oXO1oOoQod)ri?zIntegral adds methods that work on integral numbers. In short, these are conversion to int, pow with modulus, and the bit-string operations. rcr)z int(self)rrrr__int__ZIntegral.__int__Hr rcsWQ1!)z6Called whenever an index is needed, such as in slicing)rKrrr __index__ZIntegral.__index__Ms 4yrNcr)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)rr*Zmoduluss rr+ZIntegral.__pow__Qs "!rcr)z self << otherrrrr __lshift__ZIntegral.__lshift__\r rcr)z other << selfrrrr __rlshift__ZIntegral.__rlshift__ar rcr)z self >> otherrrrr __rshift__ZIntegral.__rshift__fr rcr)z other >> selfrrrr __rrshift__ZIntegral.__rrshift__kr rcr)z self & otherrrrr__and__ZIntegral.__and__pr rcr)z other & selfrrrr__rand__ZIntegral.__rand__ur rcr)z self ^ otherrrrr__xor__ZIntegral.__xor__zr rcr)z other ^ selfrrrr__rxor__ZIntegral.__rxor__r rcr)z self | otherrrrr__or__ZIntegral.__or__r rcr)z other | selfrrrr__ror__ZIntegral.__ror__r rcr)z~selfrrrr __invert__ZIntegral.__invert__r rcrB)zfloat(self) == float(int(self)))rDrKrrrr4ZIntegral.__float__sSYrcrE)z"Integers are their own numerators.rrrrrIZIntegral.numeratorrFrcr)z!Integers have a denominator of 1.irrrrrJZIntegral.denominatorrGrrH)r r r r r rrrLrMr+rNrOrPrQrRrSrTrUrVrWrXr4r0rIrJrr1r2r3rrr?sE I""""""""""""""""""""""""""  rrN)r ZabcrrZ__all__rrZregisterrCrrDrrrKrrrrYs@:( ? w (n"fn"`s7sj e;t;6axaF #r