ALL_cl_LF_OPERATIONS_SAME_PRECISION()
// For the next algorithms, I warmly recommend
-// [Jörg Arndt: hfloat documentation, august 1996,
+// [Jörg Arndt: hfloat documentation, august 1996,
// http://www.tu-chemnitz.de/~arndt/ hfdoc.dvi
// But beware of the typos in his formulas! ]
// functions. J. ACM 23(1976), 242-251.]
// [Jonathan M. Borwein, Peter B. Borwein: Pi and the AGM.
// Wiley 1987. Algorithm 2.2, p. 48.]
- // [Jörg Arndt, formula (4.51)-(4.52).]
+ // [Jörg Arndt, formula (4.51)-(4.52).]
// pi = AGM(1,1/sqrt(2))^2 * 2/(1 - sum(k=0..infty, 2^k c_k^2)).
// where the AGM iteration reads
// a_0 := 1, b_0 := 1/sqrt(2).
// )
// (/ (expt a 2) t)
// )
- var uintC actuallen = len + 1; // 1 Schutz-Digit
+ var uintC actuallen = len + 1; // 1 guard digit
var uintE uexp_limit = LF_exp_mid - intDsize*len;
- // Ein Long-Float ist genau dann betragsmäßig <2^-n, wenn
+ // Ein Long-Float ist genau dann betragsmäßig <2^-n, wenn
// sein Exponent < LF_exp_mid-n = uexp_limit ist.
var cl_LF a = cl_I_to_LF(1,actuallen);
var cl_LF b = sqrt(scale_float(a,-1));
k++;
}
var cl_LF pires = square(a)/t; // a^2/t
- return shorten(pires,len); // verkürzen und fertig
+ return shorten(pires,len); // verkürzen und fertig
}
// Bit complexity (N := len): O(log(N)*M(N)).
const cl_LF compute_pi_brent_salamin_quartic (uintC len)
{
// See [Borwein, Borwein, section 1.4, exercise 3, p. 17].
- // See also [Jörg Arndt], formulas (4.52) and (3.30)[wrong!].
+ // See also [Jörg Arndt], formulas (4.52) and (3.30)[wrong!].
// As above, we are using the formula
// pi = AGM(1,1/sqrt(2))^2 * 2/(1 - sum(k=0..infty, 2^k c_k^2)).
// where the AGM iteration reads
// = 2^(k+1) * [wa_k^4 - ((wa_k^2+wb_k^2)/2)^2].
// Hence,
// pi = AGM(1,1/sqrt(2))^2 * 1/(1/2 - sum(k even, 2^k*[....])).
- var uintC actuallen = len + 1; // 1 Schutz-Digit
+ var uintC actuallen = len + 1; // 1 guard digit
var uintE uexp_limit = LF_exp_mid - intDsize*len;
var cl_LF one = cl_I_to_LF(1,actuallen);
var cl_LF a = one;
k += 2;
}
var cl_LF pires = square(a)/t;
- return shorten(pires,len); // verkürzen und fertig
+ return shorten(pires,len); // verkürzen und fertig
}
// Bit complexity (N := len): O(log(N)*M(N)).
// mit J = -53360^3 = - (2^4 5 23 29)^3
// A = 163096908 = 2^2 3 13 1045493
// B = 6541681608 = 2^3 3^3 7 11 19 127 163
- // See [Jörg Arndt], formulas (4.27)-(4.30).
+ // See [Jörg Arndt], formulas (4.27)-(4.30).
// This is also the formula used in Pari.
// The absolute value of the n-th summand is approximately
// |J|^-n * n^(-1/2) * B/(2*pi^(3/2)),
// in precision.
// The sum is best evaluated using fixed-point arithmetic,
// so that the precision is reduced for the later summands.
- var uintC actuallen = len + 4; // 4 Schutz-Digits
+ var uintC actuallen = len + 4; // 4 guard digits
var sintC scale = intDsize*actuallen;
static const cl_I A = "163096908";
static const cl_I B = "6541681608";
var cl_LF fsum = scale_float(cl_I_to_LF(sum,actuallen),-scale);
static const cl_I J3 = "262537412640768000"; // -1728*J
var cl_LF pires = sqrt(cl_I_to_LF(J3,actuallen)) / fsum;
- return shorten(pires,len); // verkürzen und fertig
+ return shorten(pires,len); // verkürzen und fertig
}
// Bit complexity (N := len): O(N^2).
: cl_pqa_series_stream (rational_series_stream::computenext),
n (0) {}
} series;
- var uintC actuallen = len + 4; // 4 Schutz-Digits
+ var uintC actuallen = len + 4; // 4 guard digits
static const cl_I A = "163096908";
static const cl_I B = "6541681608";
static const cl_I J1 = "10939058860032000"; // 72*abs(J)
var uintC N = (n_slope*actuallen)/32 + 1;
// N > intDsize*log(2)/log(|J|) * actuallen, hence
// |J|^-N < 2^(-intDsize*actuallen).
- var cl_LF fsum = eval_rational_series(N,series,actuallen);
+ var cl_LF fsum = eval_rational_series<false>(N,series,actuallen,actuallen);
static const cl_I J3 = "262537412640768000"; // -1728*J
var cl_LF pires = sqrt(cl_I_to_LF(J3,actuallen)) / fsum;
- return shorten(pires,len); // verkürzen und fertig
+ return shorten(pires,len); // verkürzen und fertig
}
// Bit complexity (N := len): O(log(N)^2*M(N)).
const cl_LF pi (uintC len)
{
- var uintC oldlen = TheLfloat(cl_LF_pi)->len; // vorhandene Länge
+ var uintC oldlen = TheLfloat(cl_LF_pi)->len; // vorhandene Länge
if (len < oldlen)
return shorten(cl_LF_pi,len);
if (len == oldlen)
return cl_LF_pi;
// TheLfloat(cl_LF_pi)->len um mindestens einen konstanten Faktor
- // > 1 wachsen lassen, damit es nicht zu häufig nachberechnet wird:
+ // > 1 wachsen lassen, damit es nicht zu häufig nachberechnet wird:
var uintC newlen = len;
oldlen += floor(oldlen,2); // oldlen * 3/2
if (newlen < oldlen)
newlen = oldlen;
- // gewünschte > vorhandene Länge -> muß nachberechnen:
+ // gewünschte > vorhandene Länge -> muß nachberechnen:
cl_LF_pi = compute_pi_ramanujan_163_fast(newlen);
return (len < newlen ? shorten(cl_LF_pi,len) : cl_LF_pi);
}