mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Release calc version 2.11.0t9.4.1
This commit is contained in:
12
lib/README
12
lib/README
@@ -273,10 +273,18 @@ pell.cal
|
||||
pi.cal
|
||||
|
||||
qpi(epsilon)
|
||||
piforever()
|
||||
|
||||
Calculate pi within the specified epsilon using the quartic convergence
|
||||
iteration.
|
||||
The qpi() calculate pi within the specified epsilon using the quartic
|
||||
convergence iteration.
|
||||
|
||||
The piforever() prints digits of pi, nicely formatted, for as long
|
||||
as your free memory space and system up time allows.
|
||||
|
||||
The piforever() funcion (written by Klaus Alexander Seistrup
|
||||
<klaus@seistrup.dk>) was inspired by an algorithm conceived by
|
||||
Lambert Meertens. See also the ABC Programmer's Handbook, by Geurts,
|
||||
Meertens & Pemberton, published by Prentice-Hall (UK) Ltd., 1990.
|
||||
|
||||
pix.cal
|
||||
|
||||
|
@@ -86,7 +86,7 @@
|
||||
* i.e., any value that is 301 mod 420.
|
||||
*
|
||||
* Written by: Ernest W Bowen <ernie@neumann.une.edu.au>
|
||||
* Interface by: Landon Curt Noll http://reality.sgi.com/chongo
|
||||
* Interface by: Landon Curt Noll http://reality.sgi.com/chongo/
|
||||
*/
|
||||
|
||||
static defaultmlist = list(2,3,5,7,11,13,17,19); /* The first eight primes */
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Landon Curt Noll
|
||||
* http://reality.sgi.com/chongo
|
||||
* http://reality.sgi.com/chongo/
|
||||
*
|
||||
* chongo <was here> /\../\
|
||||
*/
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Landon Curt Noll
|
||||
* http://reality.sgi.com/chongo
|
||||
* http://reality.sgi.com/chongo/
|
||||
*
|
||||
* chongo <was here> /\../\
|
||||
*/
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Landon Curt Noll
|
||||
* http://reality.sgi.com/chongo
|
||||
* http://reality.sgi.com/chongo/
|
||||
*
|
||||
* chongo <was here> /\../\
|
||||
*/
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Landon Curt Noll
|
||||
* http://reality.sgi.com/chongo
|
||||
* http://reality.sgi.com/chongo/
|
||||
*
|
||||
* chongo <was here> /\../\
|
||||
*/
|
||||
|
72
lib/pi.cal
72
lib/pi.cal
@@ -47,3 +47,75 @@ define qpi(epsilon)
|
||||
}
|
||||
return (bround(1/an, bits));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Print digits of PI forever, neatly formatted, using calc.
|
||||
*
|
||||
* Written by Klaus Alexander Seistrup <klaus@seistrup.dk>
|
||||
* on a dull Friday evening in November 1999.
|
||||
*
|
||||
* Inspired by an algorithm conceived by Lambert Meertens.
|
||||
*
|
||||
* See also the ABC Programmer's Handbook, by Geurts, Meertens & Pemberton,
|
||||
* published by Prentice-Hall (UK) Ltd., 1990.
|
||||
*
|
||||
*/
|
||||
|
||||
define piforever()
|
||||
{
|
||||
local k = 2;
|
||||
local a = 4;
|
||||
local b = 1;
|
||||
local a1 = 12;
|
||||
local b1 = 4;
|
||||
local a2, b2, p, q, d, d1;
|
||||
local stdout = files(1);
|
||||
local first = 1, row = -1, col = 0;
|
||||
|
||||
while (1) {
|
||||
/*
|
||||
* Next approximation
|
||||
*/
|
||||
p = k * k;
|
||||
q = k + k++;
|
||||
|
||||
a2 = a;
|
||||
b2 = b;
|
||||
|
||||
a = a1;
|
||||
a1 = p * a2 + q * a1;
|
||||
b = b1;
|
||||
b1 = p * b2 + q * b1;
|
||||
|
||||
/*
|
||||
* Print common digits
|
||||
*/
|
||||
d = a // b;
|
||||
d1 = a1 // b1;
|
||||
|
||||
while (d == d1) {
|
||||
if (first) {
|
||||
printf("%d.", d);
|
||||
first = 0;
|
||||
} else {
|
||||
if (!(col % 50)) {
|
||||
printf("\n");
|
||||
col = 0;
|
||||
if (!(++row % 20)) {
|
||||
printf("\n");
|
||||
row = 0;
|
||||
}
|
||||
}
|
||||
printf("%d", d);
|
||||
if (!(++col % 10))
|
||||
printf(" ");
|
||||
}
|
||||
a = 10 * (a % b);
|
||||
a1 = 10 * (a1 % b1);
|
||||
d = a // b;
|
||||
d1 = a1 // b1;
|
||||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* utc_hr_offset Offset from UTC in hours.
|
||||
*
|
||||
* Written by: Klaus Alexander Seistrup <kseis@magnetic-ink.dk>
|
||||
* With minor mods by: Landon Curt Noll <http://reality.sgi.com/chongo>
|
||||
* With minor mods by: Landon Curt Noll <http://reality.sgi.com/chongo/>
|
||||
*
|
||||
* See:
|
||||
* http://www.magnetic-ink.dk/download/qtime.html
|
||||
|
@@ -22,7 +22,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Landon Curt Noll
|
||||
* http://reality.sgi.com/chongo
|
||||
* http://reality.sgi.com/chongo/
|
||||
*
|
||||
* chongo <was here> /\../\
|
||||
*/
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Landon Curt Noll
|
||||
* http://reality.sgi.com/chongo
|
||||
* http://reality.sgi.com/chongo/
|
||||
*
|
||||
* chongo <was here> /\../\
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* By: Landon Curt Noll
|
||||
* http://reality.sgi.com/chongo
|
||||
* http://reality.sgi.com/chongo/
|
||||
*
|
||||
* chongo <was here> /\../\
|
||||
*
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* By: Landon Curt Noll
|
||||
* http://reality.sgi.com/chongo
|
||||
* http://reality.sgi.com/chongo/
|
||||
*
|
||||
* chongo <was here> /\../\
|
||||
*
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* By: Ernest Bowen and Landon Curt Noll
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo/
|
||||
*
|
||||
* This library is used by the 2600 series of the regress.cal test suite.
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* By: Ernest Bowen and Landon Curt Noll
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo/
|
||||
*
|
||||
* This library is used by the 2700 series of the regress.cal test suite.
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* By: Ernest Bowen and Landon Curt Noll
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo/
|
||||
*
|
||||
* This library is used by the 3100 series of the regress.cal test suite.
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* By: Ernest Bowen and Landon Curt Noll
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo/
|
||||
*
|
||||
* This library is used by the 3300 series of the regress.cal test suite.
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* By: Ernest Bowen and Landon Curt Noll
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo/
|
||||
*
|
||||
* This library is used by the 3400 series of the regress.cal test suite.
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* By: Ernest Bowen and Landon Curt Noll
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo/
|
||||
*
|
||||
* This library is used by the 3500 series of the regress.cal test suite.
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* By: Ernest Bowen and Landon Curt Noll
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo/
|
||||
*
|
||||
* This library is used by the 4000 series of the regress.cal test suite.
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* By: Ernest Bowen and Landon Curt Noll
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo/
|
||||
*
|
||||
* This library is used by the 4100 series of the regress.cal test suite.
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* By: Ernest Bowen and Landon Curt Noll
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo/
|
||||
*
|
||||
* This library is used by the 4600 series of the regress.cal test suite.
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* By: Ernest Bowen and Landon Curt Noll
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo/
|
||||
*
|
||||
* This library is used by the 5100 series of the regress.cal test suite.
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* By: Ernest Bowen and Landon Curt Noll
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo
|
||||
* ernie@neumann.une.edu.au and http://reality.sgi.com/chongo/
|
||||
*
|
||||
* This library is used by the 5200 series of the regress.cal test suite.
|
||||
*/
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* provided that this copyright notice remains intact.
|
||||
*
|
||||
* By: Landon Curt Noll
|
||||
* http://reality.sgi.com/chongo
|
||||
* http://reality.sgi.com/chongo/
|
||||
*
|
||||
* chongo <was here> /\../\
|
||||
*
|
||||
|
Reference in New Issue
Block a user