Files
952-11/env/python/dll/Python312/Lib/__pycache__/numbers.cpython-312.pyc
T

94 lines
14 KiB
Plaintext
Raw Normal View History

2024-08-19 17:05:14 +08:00
Ë
*åfm.ãóö—dZddlmZmZgd¢ZGd„de¬«ZGd„de«Zeje«Gd „d
e«Z e je
«Gd „d e «Z Gd
„de «Z e je
«y)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ó—eZdZdZdZdZy)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 óúCC:\Users\RCi\AppData\Local\Programs\Python\Python312\Lib\numbers.pyrr%s„ñð
€Ið�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„«Zy)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ó—y)z<Return a builtin complex instance. Called for complex(self).Nr ©Úselfs rÚ __complex__zComplex.__complex__Fs�rcó —|dk7S)z)True if self != 0. Called for bool(self).rr rs rÚ__bool__zComplex.__bool__Js €à�q‰yÐrcó—t‚)zXRetrieve the real component of this number.
This should subclass Real.
©ÚNotImplementedErrorrs rÚrealz Complex.realNó
€ô"Ð!rcó—t‚)z]Retrieve the imaginary component of this number.
This should subclass Real.
rrs rÚimagz Complex.imagWr rcó—t‚)z self + otherr©rÚothers rÚ__add__zComplex.__add__`ó
€ô"Ð!rcó—t‚)z other + selfrr$s rÚ__radd__zComplex.__radd__er'rcó—t‚)z-selfrrs rÚ__neg__zComplex.__neg__jr'rcó—t‚)z+selfrrs rÚ__pos__zComplex.__pos__or'rcó—|| zS)z self - otherr r$s rÚ__sub__zComplex.__sub__ts€à�u�f‰}Ðrcó—| |zS)z other - selfr r$s rÚ__rsub__zComplex.__rsub__xs€àˆu�u‰}Ðrcó—t‚)z self * otherrr$s rÚ__mul__zComplex.__mul__|r'rcó—t‚)z other * selfrr$s rÚ__rmul__zComplex.__rmul__�r'rcó—t‚)z5self / other: Should promote to float when necessary.rr$s rÚ __truediv__zComplex.__truediv__†r'rcó—t‚)z other / selfrr$s rÚ __rtruediv__zComplex.__rtruediv__‹r'rcó—t‚)zDself ** exponent; should promote to float or complex when necessary.r)rÚexponents rÚ__pow__zComplex.__pow__�r'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 rrrr9sm„ñð€IàñKóðKòðØñ"óóð"ðØñ"óóð"ðñ"óð"ðñ"óð"ðñ"óð"ðñ"óð"òòðñ"óð"ðñ"óð"ðñ"óð"ðñ"óð"ðñ"óð"ðñ"óð"ðñ"óð"ðñ"óð"ðñ"óñ"rrcóþ—eZdZdZdZed„«Zed„«Zed„«Zed„«Z edd„«Z
d „Z d
„Z ed „«Z
ed „«Zed
„«Zed„«Zed„«Zed„«Zd„Zed„«Zed„«Zd„Zy)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‚)aKtrunc(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 (other // self, other % self).
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ó—y)z)Real numbers have no imaginary component.rr rs rr"z Real.imagó€ðrcó—|­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àñ"óð"ð ñ
"óð
"ðñ"óð"ðñ"óð"ðò"óð"ò-ò-ðñ"óð"ðñ"óð"ðñ"óð"ðñ"óð"ðñ"óð"ð ñ"óð"ò
$ðñóððñóðórrcóN—eZdZdZdZeed„««Zeed„««Zd„Z y)rz6.numerator and .denominator should be in lowest terms.r có—t‚rlrrs rÚ numeratorzRational.numerator)r'rcó—t‚rlrrs rÚ denominatorzRational.denominator.r'rcóX—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__4s#€ô�4—>‘>Ó"¤S¨×)9Ñ)9Ó%:Ñ:Ð:rN)
r r
rrrrFrrorqrIr rrrr$sE„Ù@à€Ià
Øñ"óóð"ðØñ"óóð"ó;rrcó—eZdZdZdZed„«Zd„Zedd„«Zed„«Z ed„«Z
ed „«Z ed