X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Fcomplex%2Fmisc%2Fcl_C_expt_I.cc;h=9e0bfd603c92d6619f39b6801b8429ddbb4437f4;hb=478f9e32c706f314e23cc20640f8650ce5631fe5;hp=35b35f806b3b55c4418efd2ba22afc6e99b4722d;hpb=dd9e0f894eec7e2a8cf85078330ddc0a6639090b;p=cln.git diff --git a/src/complex/misc/cl_C_expt_I.cc b/src/complex/misc/cl_C_expt_I.cc index 35b35f8..9e0bfd6 100644 --- a/src/complex/misc/cl_C_expt_I.cc +++ b/src/complex/misc/cl_C_expt_I.cc @@ -4,25 +4,27 @@ #include "cl_sysdep.h" // Specification. -#include "cl_complex.h" +#include "cln/complex.h" // Implementation. #include "cl_C.h" -#include "cl_real.h" +#include "cln/real.h" #include "cl_I.h" +namespace cln { + // Methode: -// Für y>0: +// Für y>0: // a:=x, b:=y. // Solange b gerade, setze a:=a*a, b:=b/2. [a^b bleibt invariant, = x^y.] // c:=a. // Solange b:=floor(b/2) >0 ist, // setze a:=a*a, und falls b ungerade, setze c:=a*c. // Ergebnis c. -// Für y=0: Ergebnis 1. -// Für y<0: (/ (expt x (- y))). +// Für y=0: Ergebnis 1. +// Für y<0: (/ (expt x (- y))). // Assume y>0. inline const cl_N expt_pos (const cl_N& x, const cl_I& y) @@ -47,8 +49,10 @@ const cl_N expt (const cl_N& x, const cl_I& y) return expt(x,y); } if (eq(y,0)) { return 1; } // y=0 -> Ergebnis 1 - var cl_boolean y_negative = minusp(y); + var bool y_negative = minusp(y); var cl_I abs_y = (y_negative ? -y : y); // Betrag von y nehmen var cl_N z = expt_pos(x,abs_y); // (expt x (abs y)) return (y_negative ? recip(z) : z); // evtl. noch Kehrwert nehmen } + +} // namespace cln