X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Ffloat%2Ftranscendental%2Fcl_F_expx.cc;h=9250faddb2bbcc2b8edf6cb7d9256d4e604891dc;hb=8b3d91dec77438c0fe679b10869ab29e6cdeba58;hp=16957230cbcd598a21d2766120b78fc1743b2ce3;hpb=c84c6db5d56829d69083c819688a973867694a2a;p=cln.git diff --git a/src/float/transcendental/cl_F_expx.cc b/src/float/transcendental/cl_F_expx.cc index 1695723..9250fad 100644 --- a/src/float/transcendental/cl_F_expx.cc +++ b/src/float/transcendental/cl_F_expx.cc @@ -43,24 +43,24 @@ namespace cln { const cl_LF expx_naive (const cl_LF& x) { // Methode: -// wie oben, mit adaptiver Genauigkeit während der Potenzreihen-Summation. +// wie oben, mit adaptiver Genauigkeit während der Potenzreihen-Summation. if (zerop(x)) return cl_float(1,x); - var uintL actuallen = TheLfloat(x)->len; + var uintC actuallen = TheLfloat(x)->len; var uintC d = float_digits(x); - var sintL e = float_exponent(x); + var sintE e = float_exponent(x); if (e < -(sintC)d) // e < -d ? return cl_float(1,x); // ja -> 1.0 als Ergebnis { Mutable(cl_LF,x); - var uintL k = 0; // Rekursionszähler k:=0 + var uintE k = 0; // Rekursionszähler k:=0 // Bei e <= -1-limit_slope*floor(sqrt(d)) kann die Potenzreihe // angewandt werden. limit_slope = 1.0 ist nicht schlecht, // auch im Bereich d = ca. 800. - var sintL e_limit = -1-isqrt(d); // -1-floor(sqrt(d)) + var sintL e_limit = -1-isqrtC(d); // -1-floor(sqrt(d)) if (e > e_limit) { - // e > -1-floor(sqrt(d)) -> muß |x| verkleinern. + // e > -1-floor(sqrt(d)) -> muß |x| verkleinern. k = e - e_limit; - x = scale_float(x,-(sintL)k); // x := x/2^k + x = scale_float(x,-(sintE)k); // x := x/2^k // Neuer Exponent = e-k = e_limit. } // Potenzreihe anwenden: @@ -94,22 +94,22 @@ const cl_F expx_naive (const cl_F& x) if (zerop(x)) return cl_float(1,x); var uintC d = float_digits(x); - var sintL e = float_exponent(x); + var sintE e = float_exponent(x); if (e < -(sintC)d) // e < -d ? return cl_float(1,x); // ja -> 1.0 als Ergebnis { Mutable(cl_F,x); - var uintL k = 0; // Rekursionszähler k:=0 + var uintE k = 0; // Rekursionszähler k:=0 // Bei e <= -1-limit_slope*floor(sqrt(d)) kann die Potenzreihe - // angewandt werden. limit_slope = 1.0 ist nicht schlecht. Für + // angewandt werden. limit_slope = 1.0 ist nicht schlecht. Für // d > 1600 scheint der Bereich 2.0 <= limit_slope <= 2.6 am besten - // zu sein (mit bis zu 15% Beschleunigung gegenüber limit_slope = 1.0), + // zu sein (mit bis zu 15% Beschleunigung gegenüber limit_slope = 1.0), // aber in diesem Bereich rechnen wir gar nicht. - // Wir wählen limit_slope = 1.5. - var sintL e_limit = -1-floor(isqrt(d)*3,2); // -1-floor(sqrt(d)) + // Wir wählen limit_slope = 1.5. + var sintL e_limit = -1-floor(isqrtC(d)*3,2); // -1-floor(sqrt(d)) if (e > e_limit) { - // e > -1-floor(sqrt(d)) -> muß |x| verkleinern. + // e > -1-floor(sqrt(d)) -> muß |x| verkleinern. k = e - e_limit; - x = scale_float(x,-(sintL)k); // x := x/2^k + x = scale_float(x,-(sintE)k); // x := x/2^k // Neuer Exponent = e-k = e_limit. } // Potenzreihe anwenden: @@ -139,7 +139,7 @@ const cl_LF expx_ratseries (const cl_LF& x) var uintC len = TheLfloat(x)->len; var cl_idecoded_float x_ = integer_decode_float(x); // x = (-1)^sign * 2^exponent * mantissa - var uintL lq = cl_I_to_UL(- x_.exponent); + var uintE lq = cl_I_to_UE(- x_.exponent); var const cl_I& p = x_.mantissa; // Compute exp(p/2^lq) by splitting into pieces. // Each piece gives rise to a factor exp(pk/2^lqk). @@ -151,14 +151,14 @@ const cl_LF expx_ratseries (const cl_LF& x) // (b) 311 317 305 312 295 291 286 293 291 284 295 284 293 287 288 305 // (a): N=300, time in 0.01 sec. (b): N=1000, time in 0.1 sec. // Values 2.5 <= c <= 3.2 seem best. Let's choose c = 2.875. - var cl_boolean first_factor = cl_true; + var bool first_factor = true; var cl_LF product; - var uintL b1; - var uintL b2; + var uintE b1; + var uintE b2; for (b1 = 0, b2 = 1; b1 < lq; b1 = b2, b2 = ceiling(b2*23,8)) { // Piece containing bits b1+1..b2 after "decimal point" // in the binary representation of (p/2^lq). - var uintL lqk = (lq >= b2 ? b2 : lq); + var uintE lqk = (lq >= b2 ? b2 : lq); var cl_I pk = ldb(p,cl_byte(lqk-b1,lq-lqk)); // Compute exp(pk/2^lqk). if (!zerop(pk)) { @@ -166,7 +166,7 @@ const cl_LF expx_ratseries (const cl_LF& x) var cl_LF factor = cl_exp_aux(pk,lqk,len); if (first_factor) { product = factor; - first_factor = cl_false; + first_factor = false; } else product = product * factor; }