X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;ds=inline;f=src%2Frational%2Ftranscendental%2Fcl_I_logp.cc;h=c17c80e61ad8431884c873130f0d414b2520cccf;hb=665c18cd376d8d8c5a8eafb30681a3f9f46d4a99;hp=aada2f9f76e90ebdbaa14b78e885837bb44959d2;hpb=850abfde7f0d985ba01526c346bcd0d733562943;p=cln.git diff --git a/src/rational/transcendental/cl_I_logp.cc b/src/rational/transcendental/cl_I_logp.cc index aada2f9..c17c80e 100644 --- a/src/rational/transcendental/cl_I_logp.cc +++ b/src/rational/transcendental/cl_I_logp.cc @@ -15,7 +15,7 @@ namespace cln { -cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l) +bool logp (const cl_I& a, const cl_I& b, cl_RA* l) { // Methode: // log(a,b) soll Bruch c/d mit teilerfremdem c>=0,d>0 ergeben. @@ -29,23 +29,23 @@ cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l) // Wegen a>=2^c, b>=2^d sind c,d < (integer-length a,b) < intDsize*2^intCsize. // In Matrizenschreibweise: // Wenn eine Folge von Divisionsschritten D und Vertauschungsschritten V -// ausgeführt werden muß, z.B. (a,b) V D D = (1,*), so ist +// ausgeführt werden muß, z.B. (a,b) V D D = (1,*), so ist // ( c ) ( 0 ) ( 1 1 ) ( 0 1 ) // ( d ) = V D D ( 1 ) wobei D = ( 0 1 ) und V = ( 1 0 ). -// Man baut diese Matrizen nun von links nach rechts auf, zum Schluß von +// Man baut diese Matrizen nun von links nach rechts auf, zum Schluß von // ( 0 ) // rechts mit ( 1 ) multiplizieren. // Entrekursiviert: -// Wir werden (a,b) und damit auch c/d = log(a/b) verändern. -// Invariante: Statt (c,d) wollen wir (uc*c+ud*d,vc*c+vd*d) zurückliefern. +// Wir werden (a,b) und damit auch c/d = log(a/b) verändern. +// Invariante: Statt (c,d) wollen wir (uc*c+ud*d,vc*c+vd*d) zurückliefern. // ( uc ud ) // D.h. die bisherige Matrix von links ist ( vc vd ). // uc:=1, ud:=0, vc:=0, vd:=1. // Solange a>1, // a>=b -> Dividiere a durch b. Rest da -> geht nicht. -// Sonst a:=a/b, und (für später c:=c+d) ud:=uc+ud, vd:=vc+vd. +// Sonst a:=a/b, und (für später c:=c+d) ud:=uc+ud, vd:=vc+vd. // 1 vertausche a und b, uc und ud, vc und vd. -// Liefere (ud,vd), der Bruch ud/vd ist gekürzt. +// Liefere (ud,vd), der Bruch ud/vd ist gekürzt. { Mutable(cl_I,a); Mutable(cl_I,b); var uintL uc = 1; @@ -58,7 +58,7 @@ cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l) if (a >= b) { var cl_I_div_t div = cl_divide(a,b); // a durch b dividieren if (!eq(div.remainder,0)) // Rest /=0 ? - return cl_false; // -> fertig + return false; // -> fertig a = div.quotient; // a := a/b ud = uc + ud; vd = vc + vd; } else { @@ -68,7 +68,7 @@ cl_boolean logp (const cl_I& a, const cl_I& b, cl_RA* l) } } // a=1 -> c=0,d=1 -> Ergebnis ud/vd - *l = I_I_to_RA(UL_to_I(ud),UL_to_I(vd)); return cl_true; + *l = I_I_to_RA(UL_to_I(ud),UL_to_I(vd)); return true; }} } // namespace cln