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:
@@ -9,7 +9,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
|
||||
@@ -17,11 +17,11 @@
|
||||
* 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: 1997/02/19 03:35:59
|
||||
* File existed as early as: 1997
|
||||
* Under source code control: 1997/02/19 03:35:59
|
||||
* File existed as early as: 1997
|
||||
*
|
||||
* 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/
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -41,30 +41,30 @@
|
||||
|
||||
define randomrun(run_cnt)
|
||||
{
|
||||
local i; /* index */
|
||||
local max_run; /* longest run */
|
||||
local long_run_cnt; /* number of runs longer than MAX_RUN */
|
||||
local run; /* current run length */
|
||||
local tally_sum; /* sum of all tally values */
|
||||
local last; /* last random number */
|
||||
local current; /* current random number */
|
||||
local MAX_RUN = 9; /* max run we will keep track of */
|
||||
local i; /* index */
|
||||
local max_run; /* longest run */
|
||||
local long_run_cnt; /* number of runs longer than MAX_RUN */
|
||||
local run; /* current run length */
|
||||
local tally_sum; /* sum of all tally values */
|
||||
local last; /* last random number */
|
||||
local current; /* current random number */
|
||||
local MAX_RUN = 9; /* max run we will keep track of */
|
||||
local mat tally[1:MAX_RUN]; /* tally of length of a rise run of 'x' */
|
||||
local mat prob[1:MAX_RUN]; /* prob[x] = probability of 'x' length run */
|
||||
local mat prob[1:MAX_RUN]; /* prob[x] = probability of 'x' length run */
|
||||
|
||||
/*
|
||||
* parse args
|
||||
*/
|
||||
if (param(0) == 0) {
|
||||
run_cnt = 65536;
|
||||
run_cnt = 65536;
|
||||
}
|
||||
|
||||
/*
|
||||
* run setup
|
||||
*/
|
||||
max_run = 0; /* no runs yet */
|
||||
long_run_cnt = 0; /* no long runs set */
|
||||
current = random(); /* our first number */
|
||||
max_run = 0; /* no runs yet */
|
||||
long_run_cnt = 0; /* no long runs set */
|
||||
current = random(); /* our first number */
|
||||
run = 1;
|
||||
|
||||
/*
|
||||
@@ -72,10 +72,10 @@ define randomrun(run_cnt)
|
||||
*
|
||||
* A run length of 'r' occurs with a probability of:
|
||||
*
|
||||
* 1/r! - 1/(r+1)!
|
||||
* 1/r! - 1/(r+1)!
|
||||
*/
|
||||
for (i=1; i <= MAX_RUN; ++i) {
|
||||
prob[i] = 1.0/fact(i) - 1.0/fact(i+1);
|
||||
prob[i] = 1.0/fact(i) - 1.0/fact(i+1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -83,31 +83,31 @@ define randomrun(run_cnt)
|
||||
*/
|
||||
for (i=0; i < run_cnt; ++i) {
|
||||
|
||||
/* get our current number */
|
||||
last = current;
|
||||
current = random();
|
||||
/* get our current number */
|
||||
last = current;
|
||||
current = random();
|
||||
|
||||
/* look for a run break */
|
||||
if (current < last) {
|
||||
/* look for a run break */
|
||||
if (current < last) {
|
||||
|
||||
/* record the stats */
|
||||
if (run > max_run) {
|
||||
max_run = run;
|
||||
}
|
||||
if (run > MAX_RUN) {
|
||||
++long_run_cnt;
|
||||
} else {
|
||||
++tally[run];
|
||||
}
|
||||
/* record the stats */
|
||||
if (run > max_run) {
|
||||
max_run = run;
|
||||
}
|
||||
if (run > MAX_RUN) {
|
||||
++long_run_cnt;
|
||||
} else {
|
||||
++tally[run];
|
||||
}
|
||||
|
||||
/* start a new run */
|
||||
current = random();
|
||||
run = 1;
|
||||
/* start a new run */
|
||||
current = random();
|
||||
run = 1;
|
||||
|
||||
/* note the continuing run */
|
||||
} else {
|
||||
++run;
|
||||
}
|
||||
/* note the continuing run */
|
||||
} else {
|
||||
++run;
|
||||
}
|
||||
}
|
||||
/* determine the number of runs found */
|
||||
tally_sum = matsum(tally) + long_run_cnt;
|
||||
@@ -118,9 +118,9 @@ define randomrun(run_cnt)
|
||||
printf("random run test used %d values to produce %d runs\n",
|
||||
run_cnt, tally_sum);
|
||||
for (i=1; i <= MAX_RUN; ++i) {
|
||||
printf("length=%d\tprob=%9.7f\texpect=%d \tcount=%d \terr=%9.7f\n",
|
||||
i, prob[i], round(tally_sum*prob[i]), tally[i],
|
||||
(tally[i] - round(tally_sum*prob[i]))/tally_sum);
|
||||
printf("length=%d\tprob=%9.7f\texpect=%d \tcount=%d \terr=%9.7f\n",
|
||||
i, prob[i], round(tally_sum*prob[i]), tally[i],
|
||||
(tally[i] - round(tally_sum*prob[i]))/tally_sum);
|
||||
}
|
||||
printf("length>%d\t\t\t\t\tcount=%d\n", MAX_RUN, long_run_cnt);
|
||||
printf("max length=%d\n", max_run);
|
||||
|
Reference in New Issue
Block a user