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 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 uintE 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-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,-(sintE)k); // x := x/2^k
// Neuer Exponent = e-k = e_limit.
if (e < -(sintC)d) // e < -d ?
return cl_float(1,x); // ja -> 1.0 als Ergebnis
{ Mutable(cl_F,x);
- var uintE 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.
+ // 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,-(sintE)k); // x := x/2^k
// Neuer Exponent = e-k = e_limit.
// (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 uintE b1;
var uintE b2;
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;
}