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:
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:
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).
// (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)) {
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;
}