{fXnddlZddlZddlmZmZmZmZmZejZ ifdZ GddeZ e dZ e dZe d Ze d Ze d Ze d Ze d Ze dZe dZe dZe dZ ddlZej2j5e y#e$rYywxYw)N) int_typesmpf_hashbitcount from_man_exp HASH_MODULUSc||f}||vr||S||}}|r |||z}}|r |dk7r ||z}||z}tt}||f|_|dkrt|ddkr|||<|S)Nrrd)newmpq_mpq_abs)pq_cachekeyxyvs X/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/mpmath/rational.pycreate_reducedrs Q$C f}c{ aqA !a%1 Av a a CAdAGAv#c!f+#s HceZdZdZdgZddZdZdZdZdZ e Z dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZeZdZdZdZeZdZdZdZy)r zH Exact rational type, currently only intended for internal use. rc~t|tur|\}}nt|dr|j\}}t ||S)Nr)typetuplehasattrrr)clsrrs r__new__z mpq.__new__s; 7e DAq Q 77DAqa##rc d|jzS)Nz mpq(%s,%s)rss r__repr__z mpq.__repr__&sagg%%rc d|jzS)Nz(%s/%s)r"r#s r__str__z mpq.__str__)s177""rc*|j\}}||zSNr")r$abs r__int__z mpq.__int__,sww1Av rc2t|jdSNr)boolrr#s r __nonzero__zmpq.__nonzero__0sAGGAJrc |j\}}tjdk\r[t|tdz t}|stj j }nt||ztz}|dkr| }|dk(rd}|S|dk(r t|S||dz zs!tt|dt|z St||fS)Nr4rr) rsys version_infopowr hash_infoinfrhashrrr)r$r*r+inversehs r__hash__z mpq.__hash__5sww1   v %!\!^\:GMM%%Vg%51u1"aBwBHAvAw1I Q(1+ >??1; rct|}|tur|j|jk(S|tvr|j\}}|dk7ry||k(StS)NrFrr rrNotImplementedr$tttyper*r+s r__eq__z mpq.__eq__HsSQ C<77agg% % I 77DAqAv6Mrct|}|tur|j|jk7S|tvr|j\}}|dk7ry||k7StS)NrTrArCs r__ne__z mpq.__ne__SsSQ C<77agg% % I 77DAqAv6Mrct|}|tvr|j\}}||||zS|tur-|j\}}|j\}}|||z||zStSr))rrrr NotImplementedError)r$rDoprEr*r+cds r_cmpzmpq._cmp^skQ I 77DAqa1:  C<77DAq77DAqac1Q3< ""rcB|j|tjSr))rNoperatorltr$rDs r__lt__z mpq.__lt__iQVVAx{{33rcB|j|tjSr))rNrPlerRs r__le__z mpq.__le__jrTrcB|j|tjSr))rNrPgtrRs r__gt__z mpq.__gt__krTrcB|j|tjSr))rNrPgerRs r__ge__z mpq.__ge__lrTrcd|j\}}|dk\r|Stt}| |f|_|Sr.rr r r$r*r+rs r__abs__z mpq.__abs__ns6ww1 6H H"a%rcV|j\}}tt}| |f|_|Sr)r_r`s r__neg__z mpq.__neg__vs*ww1 H"a%rc|Sr)r#s r__pos__z mpq.__pos__|srct|}|tur6|j\}}|j\}}t||z||zz||zS|tvr/|j\}}t t}|||zz|f|_|St Sr)rr rrrr rBr$rDrEr*r+rLrMrs r__add__z mpq.__add__Q C<77DAq77DAq!!A#ac'1Q3/ / I 77DAqCA!eQhAGHrct|}|tur6|j\}}|j\}}t||z||zz ||zS|tvr/|j\}}t t}|||zz |f|_|St Sr)rhris r__sub__z mpq.__sub__rkrct|}|tur6|j\}}|j\}}t||z||zz ||zS|tvr/|j\}}t t}||z|z |f|_|St Sr)rhris r__rsub__z mpq.__rsub__sQ C<77DAq77DAq!!A#ac'1Q3/ / I 77DAqCAc!eQhAGHrct|}|tur0|j\}}|j\}}t||z||zS|tvr|j\}}t||z|St Sr)rr rrrrBr$rDrEr*r+rLrMs r__mul__z mpq.__mul__mQ C<77DAq77DAq!!A#qs+ + I 77DAq!!A#q) )rct|}|tur0|j\}}|j\}}t||z||zS|tvr|j\}}t|||zSt Sr)rqrrs r__div__z mpq.__div__smQ C<77DAq77DAq!!A#qs+ + I 77DAq!!QqS) )rct|}|tur0|j\}}|j\}}t||z||zS|tvr|j\}}t||z|St Sr)rqrrs r__rdiv__z mpq.__rdiv__rtrct|}|tvrC|j\}}|r,|dkr||| }}}tt}||z||zf|_|St t Sr.)rrrr r ZeroDivisionErrorrB)r$rDrEr*r+rs r__pow__z mpq.__pow__sfQ I 77DAqq5QB!qAHQ$1*# #rN)r)__name__ __module__ __qualname____doc__ __slots__r r%r'r,r0__bool__r?rFrHrNrSrWrZr]rarcrfrj__radd__rmrors__rmul__rvrxr{rerrr r s I$&# H&   #4333  H   H   rr )rr)rr)rr4r2)rr )r)r3r)r4)r3r )r )rr )rPr7libmprrrrrobjectr r rr mpq_1mpq_0mpq_1_2mpq_3_2mpq_1_4mpq_1_16mpq_3_16mpq_5_2mpq_3_4mpq_7_4mpq_5_4numbersRationalregister ImportErrorrerrrs LL nn " "~&~B E  E  e* e* e* v; v; e* e* e* e*  c"  s B,,B43B4