mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
convert ASCII TABs to ASCII SPACEs
Converted all ASCII tabs to ASCII spaces using a 8 character tab stop, for all files, except for all Makefiles (plus rpm.mk). The `git diff -w` reports no changes.
This commit is contained in:
@@ -7,10 +7,10 @@
|
||||
* usage:
|
||||
* 4dsphere x0 y0 z0 w0 x1 y1 z1 w1 ... x5 y5 z5 w5
|
||||
*
|
||||
* x0 y0 z0 w0 point 0 in R^4
|
||||
* x1 y1 z1 w1 point 1 in R^4
|
||||
* ... ...
|
||||
* x5 y5 z5 w5 point 5 in R^4
|
||||
* x0 y0 z0 w0 point 0 in R^4
|
||||
* x1 y1 z1 w1 point 1 in R^4
|
||||
* ... ...
|
||||
* x5 y5 z5 w5 point 5 in R^4
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -41,7 +41,7 @@ stderr = files(2);
|
||||
program = argv(0);
|
||||
if (argc != 24) {
|
||||
fprintf(stderr, "usage: %s x0 y0 z0 w0 x1 y1 z1 w1 ... x5 y5 z5 w5\n",
|
||||
program);
|
||||
program);
|
||||
exit;
|
||||
}
|
||||
x0 = eval(argv(1));
|
||||
@@ -83,22 +83,22 @@ print "(":x5:",":y5:",":z5:",":w5:") ":;
|
||||
*
|
||||
* Given the 5 points:
|
||||
*
|
||||
* (x0,y1,z1,w1)
|
||||
* (x1,y1,z1,w1)
|
||||
* (x2,y2,z2,w2)
|
||||
* (x3,y3,z3,w3)
|
||||
* (x4,y4,z4,w4)
|
||||
* (x5,y5,z5,w5)
|
||||
* (x0,y1,z1,w1)
|
||||
* (x1,y1,z1,w1)
|
||||
* (x2,y2,z2,w2)
|
||||
* (x3,y3,z3,w3)
|
||||
* (x4,y4,z4,w4)
|
||||
* (x5,y5,z5,w5)
|
||||
*
|
||||
* we can determine if they lie in the surface of 4D sphere in R^4 if the
|
||||
* following matrix is 0:
|
||||
*
|
||||
* | x0^2+y0^2+z0^2+w0^2 x0 y0 z0 w0 1 |
|
||||
* | x1^2+y1^2+z1^2+w1^2 x1 y1 z1 w1 1 |
|
||||
* | x2^2+y2^2+z2^2+w2^2 x2 y2 z2 w2 1 | = 0
|
||||
* | x3^2+y3^2+z3^2+w3^2 x3 y3 z3 w3 1 |
|
||||
* | x4^2+y4^2+z4^2+w4^2 x4 y4 z4 w4 1 |
|
||||
* | x5^2+y5^2+z5^2+w5^2 x5 y5 z5 w5 1 |
|
||||
* | x0^2+y0^2+z0^2+w0^2 x0 y0 z0 w0 1 |
|
||||
* | x1^2+y1^2+z1^2+w1^2 x1 y1 z1 w1 1 |
|
||||
* | x2^2+y2^2+z2^2+w2^2 x2 y2 z2 w2 1 | = 0
|
||||
* | x3^2+y3^2+z3^2+w3^2 x3 y3 z3 w3 1 |
|
||||
* | x4^2+y4^2+z4^2+w4^2 x4 y4 z4 w4 1 |
|
||||
* | x5^2+y5^2+z5^2+w5^2 x5 y5 z5 w5 1 |
|
||||
*/
|
||||
if ((w0*(-x1*(-y2*(-z4*(z5^2+y5^2+x5^2+w5^2)
|
||||
-z3*(-z5^2+z4^2-y5^2+y4^2-x5^2+x4^2-w5^2+w4^2) +
|
||||
|
@@ -26,7 +26,7 @@ This is the correct way to form a calc shell script:
|
||||
/*
|
||||
* another correct comment
|
||||
*/
|
||||
print "2+2 =", 2+2; ## yet another comment
|
||||
print "2+2 =", 2+2; ## yet another comment
|
||||
|
||||
The first argument after the path to calc executable must be an -S.
|
||||
The next arguments are optional. The -q is often recommended because
|
||||
@@ -58,10 +58,10 @@ For more info, see:
|
||||
|
||||
4dsphere x0 y0 z0 w0 x1 y1 z1 w1 ... x5 y5 z5 w5
|
||||
|
||||
x0 y0 z0 w0 point 0 in R^4
|
||||
x1 y1 z1 w1 point 1 in R^4
|
||||
... ...
|
||||
x5 y5 z5 w5 point 5 in R^4
|
||||
x0 y0 z0 w0 point 0 in R^4
|
||||
x1 y1 z1 w1 point 1 in R^4
|
||||
... ...
|
||||
x5 y5 z5 w5 point 5 in R^4
|
||||
|
||||
|
||||
fproduct filename term ...
|
||||
@@ -102,7 +102,7 @@ simple
|
||||
##
|
||||
## Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
## Public License for more details.
|
||||
##
|
||||
## A copy of version 2.1 of the GNU Lesser General Public License is
|
||||
@@ -110,8 +110,8 @@ simple
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## Under source code control: 1999/12/17 10:23:40
|
||||
## File existed as early as: 1999
|
||||
## Under source code control: 1999/12/17 10:23:40
|
||||
## File existed as early as: 1999
|
||||
##
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
@@ -5,10 +5,10 @@
|
||||
* Copyright (C) 2001,2014,2019,2021 Landon Curt Noll
|
||||
*
|
||||
* usage:
|
||||
* fproduct filename term [term ...]
|
||||
* fproduct filename term [term ...]
|
||||
*
|
||||
* filename where to write the product, use - for stdout
|
||||
* term ... terms to multiply
|
||||
* filename where to write the product, use - for stdout
|
||||
* term ... terms to multiply
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -73,7 +73,7 @@ if (filename == "-") {
|
||||
if (product > 0) {
|
||||
octlen = int((highbit(product)+8) / 8);
|
||||
for (i=octlen-1; i >= 0; --i) {
|
||||
fputc(fd, char(product >> (i*8)));
|
||||
fputc(fd, char(product >> (i*8)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* Public License for more details.
|
||||
*
|
||||
* A copy of version 2.1 of the GNU Lesser General Public License is
|
||||
@@ -18,14 +18,14 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Under source code control: 1999/11/30 00:09:01;
|
||||
* File existed as early as: 1999
|
||||
* Under source code control: 1999/11/30 00:09:01;
|
||||
* File existed as early as: 1999
|
||||
*
|
||||
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*
|
||||
* usage:
|
||||
* mersenne exp
|
||||
* mersenne exp
|
||||
*/
|
||||
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* Public License for more details.
|
||||
*
|
||||
* A copy of version 2.1 of the GNU Lesser General Public License is
|
||||
@@ -18,14 +18,14 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Under source code control: 1999/11/30 00:11:36
|
||||
* File existed as early as: 1999
|
||||
* Under source code control: 1999/11/30 00:11:36
|
||||
* File existed as early as: 1999
|
||||
*
|
||||
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*
|
||||
* usage:
|
||||
* piforever
|
||||
* piforever
|
||||
*/
|
||||
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* Public License for more details.
|
||||
*
|
||||
* A copy of version 2.1 of the GNU Lesser General Public License is
|
||||
@@ -18,14 +18,14 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Under source code control: 1999/11/29 10:22:37
|
||||
* File existed as early as: 1999
|
||||
* Under source code control: 1999/11/29 10:22:37
|
||||
* File existed as early as: 1999
|
||||
*
|
||||
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*
|
||||
* usage:
|
||||
* plus val ...
|
||||
* plus val ...
|
||||
*/
|
||||
|
||||
|
||||
|
@@ -7,16 +7,16 @@
|
||||
* usage:
|
||||
* powerterm [base_limit] value
|
||||
*
|
||||
* base_limit largest base we will consider (def: 10000)
|
||||
* value value to convert into sums of powers of integers
|
||||
* base_limit largest base we will consider (def: 10000)
|
||||
* value value to convert into sums of powers of integers
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* powerterm 5 1000000
|
||||
* powerterm 5 1000000
|
||||
*
|
||||
* prints:
|
||||
*
|
||||
* 4^10 - 3^10 + 5^6 - 4^6 - 4^5 - 2^5
|
||||
* 4^10 - 3^10 + 5^6 - 4^6 - 4^5 - 2^5
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the powerterm of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -47,7 +47,7 @@ argc = argv();
|
||||
stderr = files(2);
|
||||
program = argv(0);
|
||||
config("verbose_quit", 0),;
|
||||
base_lim = 10000; /* default: highest base we will consider */
|
||||
base_lim = 10000; /* default: highest base we will consider */
|
||||
if (argc < 2 || argc > 3) {
|
||||
fprintf(stderr, "usage: %s [base_limit] value\n", program);
|
||||
exit;
|
||||
@@ -75,20 +75,20 @@ if (base_lim <= 1) {
|
||||
/*
|
||||
* setup loop variables
|
||||
*/
|
||||
term = 0; /* number of powerterm found */
|
||||
term = 0; /* number of powerterm found */
|
||||
|
||||
/*
|
||||
* log constants
|
||||
*/
|
||||
if (base_lim <= 2^20+1) { /* 2^20 requires ~96 Megs of memory */
|
||||
mat lni[base_lim]; /* log of integers */
|
||||
if (base_lim <= 2^20+1) { /* 2^20 requires ~96 Megs of memory */
|
||||
mat lni[base_lim]; /* log of integers */
|
||||
for (i=2; i < base_lim; ++i) {
|
||||
lni[i] = ln(i);
|
||||
lni[i] = ln(i);
|
||||
}
|
||||
have_lni = 1; /* have lni[x] array */
|
||||
have_lni = 1; /* have lni[x] array */
|
||||
} else {
|
||||
mat lni[1]; /* not used */
|
||||
have_lni = 0; /* base_lim too large for array */
|
||||
mat lni[1]; /* not used */
|
||||
have_lni = 0; /* base_lim too large for array */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -99,82 +99,82 @@ while (abs(x) >= base_lim) {
|
||||
/*
|
||||
* look for the nearest power
|
||||
*/
|
||||
lnx = ln(abs(x)); /* log of the remaining co-factor */
|
||||
lnx = ln(abs(x)); /* log of the remaining co-factor */
|
||||
closest = 0.5;
|
||||
base = 1;
|
||||
exponent = 0;
|
||||
if (have_lni) {
|
||||
|
||||
/*
|
||||
* use pre-calculated log array when looking for the nearest power
|
||||
*/
|
||||
for (i = 2; i < base_lim; ++i) {
|
||||
/*
|
||||
* use pre-calculated log array when looking for the nearest power
|
||||
*/
|
||||
for (i = 2; i < base_lim; ++i) {
|
||||
|
||||
/*
|
||||
* determine exponent closeness to an integer
|
||||
*/
|
||||
ex = lnx / lni[i];
|
||||
power = int(ex + 0.5);
|
||||
diff = ex - power;
|
||||
/*
|
||||
* determine exponent closeness to an integer
|
||||
*/
|
||||
ex = lnx / lni[i];
|
||||
power = int(ex + 0.5);
|
||||
diff = ex - power;
|
||||
|
||||
/*
|
||||
* look for a closer power
|
||||
*/
|
||||
if (abs(diff) < closest) {
|
||||
closest = abs(diff);
|
||||
base = i;
|
||||
exponent = power;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* look for a closer power
|
||||
*/
|
||||
if (abs(diff) < closest) {
|
||||
closest = abs(diff);
|
||||
base = i;
|
||||
exponent = power;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/*
|
||||
* re-calculate logs when looking for the nearest power
|
||||
*/
|
||||
for (i = 2; i < base_lim; ++i) {
|
||||
/*
|
||||
* re-calculate logs when looking for the nearest power
|
||||
*/
|
||||
for (i = 2; i < base_lim; ++i) {
|
||||
|
||||
/*
|
||||
* determine exponent closeness to an integer
|
||||
*/
|
||||
ex = lnx / ln(i);
|
||||
power = int(ex + 0.5);
|
||||
diff = ex - power;
|
||||
/*
|
||||
* determine exponent closeness to an integer
|
||||
*/
|
||||
ex = lnx / ln(i);
|
||||
power = int(ex + 0.5);
|
||||
diff = ex - power;
|
||||
|
||||
/*
|
||||
* look for a closer power
|
||||
*/
|
||||
if (abs(diff) < closest) {
|
||||
closest = abs(diff);
|
||||
base = i;
|
||||
exponent = power;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* look for a closer power
|
||||
*/
|
||||
if (abs(diff) < closest) {
|
||||
closest = abs(diff);
|
||||
base = i;
|
||||
exponent = power;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* output current term and then subtract it
|
||||
*/
|
||||
if (x != 0) {
|
||||
if (x < 0) {
|
||||
print "-",;
|
||||
} else if (term > 0) {
|
||||
print "+",;
|
||||
}
|
||||
if (exponent > 1) {
|
||||
print base: "^": exponent,;
|
||||
} else {
|
||||
print base,;
|
||||
}
|
||||
if (x < 0) {
|
||||
print "-",;
|
||||
} else if (term > 0) {
|
||||
print "+",;
|
||||
}
|
||||
if (exponent > 1) {
|
||||
print base: "^": exponent,;
|
||||
} else {
|
||||
print base,;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* subtract (or add) this near power
|
||||
*/
|
||||
if (x < 0) {
|
||||
x = x + base^exponent;
|
||||
x = x + base^exponent;
|
||||
} else {
|
||||
x = x - base^exponent;
|
||||
x = x - base^exponent;
|
||||
}
|
||||
++term;
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* Public License for more details.
|
||||
*
|
||||
* A copy of version 2.1 of the GNU Lesser General Public License is
|
||||
@@ -18,10 +18,10 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Under source code control: 1999/11/29 10:22:37
|
||||
* File existed as early as: 1999
|
||||
* Under source code control: 1999/11/29 10:22:37
|
||||
* File existed as early as: 1999
|
||||
*
|
||||
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*/
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
*
|
||||
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* Public License for more details.
|
||||
*
|
||||
* A copy of version 2.1 of the GNU Lesser General Public License is
|
||||
@@ -18,8 +18,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Under source code control: 2000/12/15 06:52:01
|
||||
* File existed as early as: 2000
|
||||
* Under source code control: 2000/12/15 06:52:01
|
||||
* File existed as early as: 2000
|
||||
*
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*/
|
||||
@@ -48,8 +48,8 @@
|
||||
* 1522756
|
||||
* ln(2)
|
||||
* ~.48045301391820142467
|
||||
* 2i
|
||||
* -4
|
||||
* 2i
|
||||
* -4
|
||||
* config("mode","frac"), bernoulli(10)
|
||||
* 25/4356
|
||||
* config("mode", "hex"), 0xff
|
||||
@@ -58,5 +58,5 @@
|
||||
|
||||
|
||||
while (s = fgetline(files(0))) {
|
||||
print "\t":eval(s)^2;
|
||||
print "\t":eval(s)^2;
|
||||
}
|
||||
|
Reference in New Issue
Block a user