Remove unnecessary leading line whitespace before a tab

This commit is contained in:
Landon Curt Noll
2021-11-07 20:14:28 -08:00
parent 2ca6e789ca
commit 27f977b545
45 changed files with 144 additions and 144 deletions

76
CHANGES
View File

@@ -839,7 +839,7 @@ The following are the changes from calc version 2.12.5.4 to 2.12.5.6:
Rewrote gen_v1() in the lucas.cal resource file using the method Rewrote gen_v1() in the lucas.cal resource file using the method
based on a paper: based on a paper:
"A note on primality tests for N = h*2^n-1", by Oystein J. Rodseth, "A note on primality tests for N = h*2^n-1", by Oystein J. Rodseth,
Department of Mathematics, University of Bergen, BIT Numerical Department of Mathematics, University of Bergen, BIT Numerical
Mathematics. 34 (3): pp 451-454. Mathematics. 34 (3): pp 451-454.
@@ -898,13 +898,13 @@ The following are the changes from calc version 2.12.5.3 to 2.12.5.3:
macOS (Darwin) users who installed calc version 2.12.5.2 macOS (Darwin) users who installed calc version 2.12.5.2
should, after installing version 2.12.5.3: should, after installing version 2.12.5.3:
rm -rf /opt/calc rm -rf /opt/calc
The following are the changes from calc version 2.12.5.1 to 2.12.5.2: The following are the changes from calc version 2.12.5.1 to 2.12.5.2:
NOTE: calc version 2.12.5.2, for macOS (Darwin) users, NOTE: calc version 2.12.5.2, for macOS (Darwin) users,
installed under /opt/calc. We neglected to mention this installed under /opt/calc. We neglected to mention this
AND /usr/local would have been a better choice. Sorry! AND /usr/local would have been a better choice. Sorry!
Fixed in calc version 2.12.5.3. Fixed in calc version 2.12.5.3.
@@ -977,7 +977,7 @@ The following are the changes from calc version 2.12.4.14 to 2.12.5.0:
For Apple OS X / Darwin target: For Apple OS X / Darwin target:
MACOSX_DEPLOYMENT_TARGET is no longer defined MACOSX_DEPLOYMENT_TARGET is no longer defined
using clang compiler using clang compiler
By default, -install-name is used when forming shared libs. By default, -install-name is used when forming shared libs.
@@ -1021,9 +1021,9 @@ The following are the changes from calc version 2.12.4.14 to 2.12.5.0:
for mul2, sq2, and pow2. However, it has been shown that this for mul2, sq2, and pow2. However, it has been shown that this
code is not correct. Suggestions for a replacement are welcome! code is not correct. Suggestions for a replacement are welcome!
calc -u 'read alg_config; config("user_debug", 2),; best_mul2();' calc -u 'read alg_config; config("user_debug", 2),; best_mul2();'
calc -u 'read alg_config; config("user_debug", 2),; best_sq2();' calc -u 'read alg_config; config("user_debug", 2),; best_sq2();'
calc -u 'read alg_config; config("user_debug", 2),; best_pow2();' calc -u 'read alg_config; config("user_debug", 2),; best_pow2();'
Fixed a number of pedantic compiler warnings. Fixed a number of pedantic compiler warnings.
@@ -1190,7 +1190,7 @@ The following are the changes from calc version 2.12.4.6 to version 2.12.4.10:
With the exception of 3 source files, we became "picky" about With the exception of 3 source files, we became "picky" about
line lengths and other issues reported by the picky tool: line lengths and other issues reported by the picky tool:
cal/test8900.cal cal/test8900.cal
cal/set8700.line cal/set8700.line
help/errorcodes.sed help/errorcodes.sed
@@ -1246,7 +1246,7 @@ The following are the changes from calc version 2.12.4.0 to 2.12.4.2:
Added prep makefile rule to make is easier to compile calc without Added prep makefile rule to make is easier to compile calc without
an optimizer. By doing: an optimizer. By doing:
make clobber prep make clobber prep
one may build a calc binary that is easier to debug. one may build a calc binary that is easier to debug.
@@ -1403,7 +1403,7 @@ The following are the changes from calc version 2.12.1.1 to 2.12.2.2:
what was calc-something.tar.gz is now calc-something.tar.bz2. what was calc-something.tar.gz is now calc-something.tar.bz2.
To "uncompress" use: To "uncompress" use:
bunzip2 calc-something.tar.bz2 bunzip2 calc-something.tar.bz2
On some systems, one may untar directly by: On some systems, one may untar directly by:
@@ -1468,7 +1468,7 @@ The following are the changes from calc version 2.12.1.10 to 2.12.2:
Renamed the following variables related to calc error processing: Renamed the following variables related to calc error processing:
int calc_jmp ==> int calc_use_matherr_jmpbuf int calc_jmp ==> int calc_use_matherr_jmpbuf
jmp_buf calc_jmp_buf ==> jmp_buf calc_matherr_jmpbuf jmp_buf calc_jmp_buf ==> jmp_buf calc_matherr_jmpbuf
int post_init ==> int calc_use_scanerr_jmpbuf int post_init ==> int calc_use_scanerr_jmpbuf
jmp_buf jmpbuf ==> jmpbuf calc_scanerr_jmpbuf jmp_buf jmpbuf ==> jmpbuf calc_scanerr_jmpbuf
@@ -1483,7 +1483,7 @@ The following are the changes from calc version 2.12.1.10 to 2.12.2:
Parse/scan errors will not be printed if calc_print_scanerr_msg Parse/scan errors will not be printed if calc_print_scanerr_msg
is zero. By default: is zero. By default:
int calc_print_scanerr_msg = 1; int calc_print_scanerr_msg = 1;
This variable is declared in the lib_calc.h include file. Storage This variable is declared in the lib_calc.h include file. Storage
comes from libcalc. comes from libcalc.
@@ -1491,7 +1491,7 @@ The following are the changes from calc version 2.12.1.10 to 2.12.2:
Parse/scan warnings will not be printed if calc_print_scanwarn_msg Parse/scan warnings will not be printed if calc_print_scanwarn_msg
is zero. By default: is zero. By default:
int calc_print_scanwarn_msg = 1; int calc_print_scanwarn_msg = 1;
This variable is declared in the lib_calc.h include file. Storage This variable is declared in the lib_calc.h include file. Storage
comes from libcalc. comes from libcalc.
@@ -1527,13 +1527,13 @@ The following are the changes from calc version 2.12.1.10 to 2.12.2:
Replaced the concept of compiler sets in the Makefile with Replaced the concept of compiler sets in the Makefile with
host target section in the Makefile. Initial host targets are: host target section in the Makefile. Initial host targets are:
Linux Linux
Darwin Darwin
FreeBSD FreeBSD
(default) <<== Target does not match any previous target name (default) <<== Target does not match any previous target name
Simple Simple
NOTE: If your target is not supported below and the default target NOTE: If your target is not supported below and the default target
is not suitable for your needs, please send to the: is not suitable for your needs, please send to the:
calc-contrib at asthe dot com calc-contrib at asthe dot com
@@ -1681,7 +1681,7 @@ The following are the changes from calc version 2.12.1.8 to 2.12.1.9:
comments. Improved calc comment documentation in "help unexpected" comments. Improved calc comment documentation in "help unexpected"
to help other avoid similar mistakes. Calc comments are of the form: to help other avoid similar mistakes. Calc comments are of the form:
/* c style comments */ /* c style comments */
/* /*
* multi-line * multi-line
* comments * comments
@@ -1695,7 +1695,7 @@ The following are the changes from calc version 2.12.1.8 to 2.12.1.9:
Documented these help commands in "help help": Documented these help commands in "help help":
help -> help ->
help * help *
help . help .
help % help %
@@ -1876,7 +1876,7 @@ The following are the changes from calc version 2.12.0 to 2.12.0.8:
Added the builtin function fpathopen() to open a file while Added the builtin function fpathopen() to open a file while
searching along a path: searching along a path:
; fd2 = fpathopen("tmp/date", "r", ".:~:~sc:/tmp:/var/tmp:/var") ; fd2 = fpathopen("tmp/date", "r", ".:~:~sc:/tmp:/var/tmp:/var")
; print fd2 ; print fd2
"/var/tmp/date" "/var/tmp/date"
@@ -1926,12 +1926,12 @@ The following are the changes from calc version 2.12.0 to 2.12.0.8:
level. When comparing with older source, one may use the -b argument level. When comparing with older source, one may use the -b argument
of the diff command to ignore changes in amount of white space: of the diff command to ignore changes in amount of white space:
diff -b -r -u calc-2.11.11 calc-2.12.0 diff -b -r -u calc-2.11.11 calc-2.12.0
The read, write, and help commands use the value of global string The read, write, and help commands use the value of global string
variable if the symbol name starts with a $. For example: variable if the symbol name starts with a $. For example:
global x = "lucas.cal"; global x = "lucas.cal";
read $x; /* same as read lucas.cal or read "lucas.cal" */ read $x; /* same as read lucas.cal or read "lucas.cal" */
Added dotest.cal resource. Based on a design by Ernest Bowen Added dotest.cal resource. Based on a design by Ernest Bowen
@@ -2041,7 +2041,7 @@ The following are the changes from calc version 2.12.0 to 2.12.0.8:
Changed the default values for the following config() parameters: Changed the default values for the following config() parameters:
config("mul2") == 1780 config("mul2") == 1780
config("sq2") == 3388 config("sq2") == 3388
config("pow2") == 176 config("pow2") == 176
@@ -2136,10 +2136,10 @@ The following are the changes from calc version 2.12.0 to 2.12.0.8:
value is TRUE by default. Examples of variable name collisions value is TRUE by default. Examples of variable name collisions
include when: include when:
* both local and static variables have the same name * both local and static variables have the same name
* both local and global variables have the same name * both local and global variables have the same name
* both function parameter and local variables have the same name * both function parameter and local variables have the same name
* both function parameter and global variables have the same name * both function parameter and global variables have the same name
Fix of a bug which causes some static variables not to be correctly Fix of a bug which causes some static variables not to be correctly
unscoped when their identifiers are used in a global declaration. unscoped when their identifiers are used in a global declaration.
@@ -2159,7 +2159,7 @@ The following are the changes from calc version 2.12.0 to 2.12.0.8:
Changed the definition of the function ssq() to enable list arguments Changed the definition of the function ssq() to enable list arguments
to be processed in the same way as in sum(). For example: to be processed in the same way as in sum(). For example:
ssq(1,2, list(3,4,list(5,6)), list(), 7, 8) ssq(1,2, list(3,4,list(5,6)), list(), 7, 8)
returns the value of 1^2 + 2^2 + ... + 8^2 == 204. returns the value of 1^2 + 2^2 + ... + 8^2 == 204.
@@ -2167,7 +2167,7 @@ The following are the changes from calc version 2.12.0 to 2.12.0.8:
various ways of evaluating sums, sums of squares, etc, for large various ways of evaluating sums, sums of squares, etc, for large
lists and matrices. For example: lists and matrices. For example:
read sumtimes read sumtimes
doalltimes(1e6) doalltimes(1e6)
Calc now ignores carriage returns (\r), vertical tabs (\v), and Calc now ignores carriage returns (\r), vertical tabs (\v), and
@@ -2206,7 +2206,7 @@ The following are the changes from calc version 2.11.10.1 to 2.11.11:
Fixed a bug reported by the sourceforge user: cedars where: Fixed a bug reported by the sourceforge user: cedars where:
ln(exp(6)) == 3 /* WRONG!!! */ ln(exp(6)) == 3 /* WRONG!!! */
incorrectly returned 1. This bug was fixed by Ernest Bowen incorrectly returned 1. This bug was fixed by Ernest Bowen
<ebowen at une dot edu dot au>. The regression test <ebowen at une dot edu dot au>. The regression test
@@ -2311,7 +2311,7 @@ The following are the changes from calc version 2.11.10 to 2.11.10:
Fixed -d so that: Fixed -d so that:
calc -d 2/3 calc -d 2/3
will print 0.66666666666666666667 without the leading tilde as will print 0.66666666666666666667 without the leading tilde as
advertised in the man page. advertised in the man page.
@@ -2331,7 +2331,7 @@ The following are the changes from calc version 2.11.10 to 2.11.10:
Added custom function: Added custom function:
custom("pmodm127", q) custom("pmodm127", q)
to compute 2^(2^127-1) mod q. While currently slower than just to compute 2^(2^127-1) mod q. While currently slower than just
doing pmod(2,2^127-1,q), it is added to give an example of a doing pmod(2,2^127-1,q), it is added to give an example of a
@@ -2422,7 +2422,7 @@ The following are the changes from calc version 2.11.8.0 to 2.11.8.1:
configuration (calc -n or config("all", "newstd")) is now the default configuration (calc -n or config("all", "newstd")) is now the default
calc configuration. The flag: calc configuration. The flag:
calc -O calc -O
was added to get the old classic calc configuration. The flag command was added to get the old classic calc configuration. The flag command
line flag, -n, now does nothing. Use of -n is deprecated and may go line flag, -n, now does nothing. Use of -n is deprecated and may go
@@ -2599,16 +2599,16 @@ The following are the changes from calc version 2.11.5.5 to 2.11.5.9:
Now using version numbers of one of these forms: Now using version numbers of one of these forms:
x.y.z.w x.y.z.w
x.y.z x.y.z
x.y x.y
Changed the READLINE_LIB Makefile variable to not link with -lreadline Changed the READLINE_LIB Makefile variable to not link with -lreadline
by default. If you do have readline, we recommend that you use it. by default. If you do have readline, we recommend that you use it.
If you can install the GNU readline: If you can install the GNU readline:
http://freshmeat.net/projects/gnureadline/ http://freshmeat.net/projects/gnureadline/
http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
we recommend it. But if not, you should set the USE_READLINE, we recommend it. But if not, you should set the USE_READLINE,
READLINE_LIB, and READLINE_INCLUDE Makefile variables to empty. READLINE_LIB, and READLINE_INCLUDE Makefile variables to empty.
@@ -2680,7 +2680,7 @@ The following are the changes from calc version 2.11.5t4.1 to 2.11.5t4.4:
Added subject requirements for the calc-tester-request and Added subject requirements for the calc-tester-request and
calc-bugs-mail Email aliases. See: calc-bugs-mail Email aliases. See:
http://www.isthe.com/chongo/tech/comp/calc/email.html http://www.isthe.com/chongo/tech/comp/calc/email.html
for details. for details.
@@ -2847,7 +2847,7 @@ The following are the changes from calc version 2.11.5t2 to 2.11.5t2.1:
Applied a bug fix from Ernest Bowen <ernie at turing dot une dot Applied a bug fix from Ernest Bowen <ernie at turing dot une dot
edu dot au> dealing with one-line "static" declaration like: edu dot au> dealing with one-line "static" declaration like:
static a = 1, b; static a = 1, b;
Added regression test 8310 to test for the static bug fix. Added regression test 8310 to test for the static bug fix.
@@ -2960,7 +2960,7 @@ The following are the changes from calc version 2.11.5t0 to 2.11.5t1.1:
Configuration values that used to return "true" or "false" now return Configuration values that used to return "true" or "false" now return
1 (a true value) or 0 (a false value). Thus one can do: 1 (a true value) or 0 (a false value). Thus one can do:
if (config("tab")) { ... } else { ... } if (config("tab")) { ... } else { ... }
The configuration values that now return 1 or 0 are: The configuration values that now return 1 or 0 are:

View File

@@ -186,7 +186,7 @@ bernoulli.cal
Calculate the nth Bernoulli number. Calculate the nth Bernoulli number.
NOTE: There is now a bernoulli() builtin function. This file is NOTE: There is now a bernoulli() builtin function. This file is
left here for backward compatibility and now simply returns left here for backward compatibility and now simply returns
the builtin function. the builtin function.
@@ -767,7 +767,7 @@ lucas.cal
prove that h*2^n-1 is prime or not prime. prove that h*2^n-1 is prime or not prime.
NOTE: Some call this term u(0). The function gen_u0(h, n, v1) NOTE: Some call this term u(0). The function gen_u0(h, n, v1)
simply calls gen_u2(h, n, v1) for such people. :-) simply calls gen_u2(h, n, v1) for such people. :-)
gen_v1(h, v) gen_v1(h, v)
@@ -1467,7 +1467,7 @@ sumtimes.cal
the list or matrix to use. The doalltimes() function will run the list or matrix to use. The doalltimes() function will run
all of the sumtimes tests. For example: all of the sumtimes tests. For example:
doalltimes(1e6); doalltimes(1e6);
surd.cal surd.cal

View File

@@ -474,7 +474,7 @@ define best_mul2()
*/ */
while (low+1 < high) { while (low+1 < high) {
/* try the mid-point */ /* try the mid-point */
mid = int((low+high)/2); mid = int((low+high)/2);
if (config("user_debug") > 0) { if (config("user_debug") > 0) {
printf("testing multiply alg1/alg2 ratio for len = %d\n", mid); printf("testing multiply alg1/alg2 ratio for len = %d\n", mid);
@@ -956,7 +956,7 @@ define best_sq2()
*/ */
while (low+1 < high) { while (low+1 < high) {
/* try the mid-point */ /* try the mid-point */
mid = int((low+high)/2); mid = int((low+high)/2);
if (config("user_debug") > 0) { if (config("user_debug") > 0) {
printf("testing square alg1/alg2 ratio for len = %d\n", mid); printf("testing square alg1/alg2 ratio for len = %d\n", mid);
@@ -1455,7 +1455,7 @@ define best_pow2()
*/ */
while (low+1 < high) { while (low+1 < high) {
/* try the mid-point */ /* try the mid-point */
mid = int((low+high)/2); mid = int((low+high)/2);
if (config("user_debug") > 0) { if (config("user_debug") > 0) {
printf("testing pow2 alg1/alg2 ratio for len = %d\n", mid); printf("testing pow2 alg1/alg2 ratio for len = %d\n", mid);

View File

@@ -40,7 +40,7 @@ define Z(x, eps_term)
/* obtain the error term */ /* obtain the error term */
if (isnull(eps_term)) { if (isnull(eps_term)) {
eps = epsilon(); eps = epsilon();
} else { } else {
eps = eps_term; eps = eps_term;
} }
@@ -81,7 +81,7 @@ define P(x, eps_term)
/* obtain the error term */ /* obtain the error term */
if (isnull(eps_term)) { if (isnull(eps_term)) {
eps = epsilon(); eps = epsilon();
} else { } else {
eps = eps_term; eps = eps_term;
} }

View File

@@ -188,7 +188,7 @@ define dms_abs(a)
/* firewall - just absolute value non dms objects */ /* firewall - just absolute value non dms objects */
if (! istype(a, ans)) { if (! istype(a, ans)) {
return abs(a); return abs(a);
} }
/* compute degrees */ /* compute degrees */

View File

@@ -157,7 +157,7 @@ define dotest(dotest_file, dotest_code = 0, dotest_maxcond = -1)
* test the close of the line file * test the close of the line file
*/ */
printf("%d-: detected %d error condition(s), many of which may be OK\n", printf("%d-: detected %d error condition(s), many of which may be OK\n",
dotest_code, dotest_old_errcount-dotest_errcnt); dotest_code, dotest_old_errcount-dotest_errcnt);
printf("%d-: closing line file: %d\n", dotest_code, dotest_file); printf("%d-: closing line file: %d\n", dotest_code, dotest_file);
fclose(dotest_f_file); fclose(dotest_f_file);

View File

@@ -56,7 +56,7 @@ define __CZ__factor_factorial(n,start){
if(start){ if(start){
if(!isint(start) && start < 0 && start > n) if(!isint(start) && start < 0 && start > n)
return newerror("__CZ__factor_factorial(n,start): value of " return newerror("__CZ__factor_factorial(n,start): value of "
"parameter 'start' out of range"); "parameter 'start' out of range");
if(start == n && isprime(n)){ if(start == n && isprime(n)){
prime_list = mat[1 , 2]; prime_list = mat[1 , 2];
prime_list[0,0] = n; prime_list[0,0] = n;
@@ -64,7 +64,7 @@ define __CZ__factor_factorial(n,start){
} }
else if(!isprime(start) && nextprime(start) >n) else if(!isprime(start) && nextprime(start) >n)
return newerror("__CZ__factor_factorial(n,start): value of parameter " return newerror("__CZ__factor_factorial(n,start): value of parameter "
"'start' out of range"); "'start' out of range");
else{ else{
if(!isprime(start)) prime = nextprime(start); if(!isprime(start)) prime = nextprime(start);
else prime = start; else prime = start;
@@ -225,11 +225,11 @@ define __CZ__multiply_factored_factorial(matrix,stop){
if(!ismat(matrix)) if(!ismat(matrix))
return newerror("__CZ__multiply_factored_factorial(matrix): " return newerror("__CZ__multiply_factored_factorial(matrix): "
"argument matrix not a matrix "); "argument matrix not a matrix ");
if(!matrix[0,0]) if(!matrix[0,0])
return return
newerror("__CZ__multiply_factored_factorial(matrix): " newerror("__CZ__multiply_factored_factorial(matrix): "
"matrix[0,0] is null/0"); "matrix[0,0] is null/0");
if(!isnull(stop)) if(!isnull(stop))
pix = stop; pix = stop;
@@ -376,7 +376,7 @@ define bigcatalan(n){
/* /*
df(-111) = -1/3472059605858239446587523014902616804783337112829102414124928 df(-111) = -1/3472059605858239446587523014902616804783337112829102414124928
7753332469144201839599609375 7753332469144201839599609375
df(-3+1i) = 0.12532538977287649201-0.0502372106177184607i df(-3+1i) = 0.12532538977287649201-0.0502372106177184607i
df(2n + 1) = (2*n)!/(n!*2^n) df(2n + 1) = (2*n)!/(n!*2^n)
@@ -427,7 +427,7 @@ define doublefactorial(n){
*/ */
eps=epsilon(epsilon()*1e-2); eps=epsilon(epsilon()*1e-2);
ret = 2^(n/2-1/4 * cos(pi()* n)+1/4) * pi()^(1/4 * ret = 2^(n/2-1/4 * cos(pi()* n)+1/4) * pi()^(1/4 *
cos(pi()* n)-1/4)* gamma(n/2+1); cos(pi()* n)-1/4)* gamma(n/2+1);
epsilon(eps); epsilon(eps);
return ret; return ret;
} }

View File

@@ -188,7 +188,7 @@ define hms_abs(a)
/* firewall - just absolute value non hms objects */ /* firewall - just absolute value non hms objects */
if (! istype(a, ans)) { if (! istype(a, ans)) {
return abs(a); return abs(a);
} }
/* compute hours */ /* compute hours */

View File

@@ -156,7 +156,7 @@ define be2file(v, filename)
*/ */
octlen = int((highbit(v)+8) / 8); octlen = int((highbit(v)+8) / 8);
for (i=octlen-1; i >= 0; --i) { for (i=octlen-1; i >= 0; --i) {
fputc(fd, char(v >> (i*8))); fputc(fd, char(v >> (i*8)));
} }
/* /*

View File

@@ -731,7 +731,7 @@ rodseth_xhn(x, h, n)
return 0; return 0;
} }
/* /*
* Check for jacobi(x-2, h*2^n-1) == 1 (Ref4, condition 1) part 1 * Check for jacobi(x-2, h*2^n-1) == 1 (Ref4, condition 1) part 1
*/ */
testval = h*2^n-1; testval = h*2^n-1;
@@ -739,7 +739,7 @@ rodseth_xhn(x, h, n)
return 0; return 0;
} }
/* /*
* Check for jacobi(x+2, h*2^n-1) == -1 (Ref4, condition 1) part 2 * Check for jacobi(x+2, h*2^n-1) == -1 (Ref4, condition 1) part 2
*/ */
if (jacobi(x+2, testval) != -1) { if (jacobi(x+2, testval) != -1) {

View File

@@ -336,7 +336,7 @@ define __CZ__produce_long_random_number(n)
ret = 1; ret = 1;
if(!isint(n) || n<1) if(!isint(n) || n<1)
return newerror("__CZ__produce_long_random_number(n): " return newerror("__CZ__produce_long_random_number(n): "
"n is not an integer >=1"); "n is not an integer >=1");
for(k=0;k<n;k++){ for(k=0;k<n;k++){
ret += random(); ret += random();
ret = toomcook4square(ret); ret = toomcook4square(ret);

View File

@@ -72,7 +72,7 @@ define hurwitzzeta(s,a){
limit=(precision*ln(10)-re((s-.5)*result)+(1.*realpart_a)*ln(2.*pi()))/2; limit=(precision*ln(10)-re((s-.5)*result)+(1.*realpart_a)*ln(2.*pi()))/2;
limit=max(2,ceil(max(limit,abs(s*1.)/2))); limit=max(2,ceil(max(limit,abs(s*1.)/2)));
limit_function=ceil(sqrt((limit+realpart_a/2-.25)^2+(imagpart_s*1.)^2/4)/ limit_function=ceil(sqrt((limit+realpart_a/2-.25)^2+(imagpart_s*1.)^2/4)/
pi()); pi());
if (config("user_debug") > 0) { if (config("user_debug") > 0) {
print "limit_function = " limit_function; print "limit_function = " limit_function;
print "limit = " limit; print "limit = " limit;

View File

@@ -374,12 +374,12 @@ Step 5: Write your custom function
One is able to set bit 8 by way of the calc command line: One is able to set bit 8 by way of the calc command line:
calc -D 128 calc -D 128
See the calc man page for details. One may also set that bit See the calc man page for details. One may also set that bit
while running calc by way of the config() builtin function: while running calc by way of the config() builtin function:
config("calc_debug", 128); config("calc_debug", 128);
See the help/config file for details on calc_debug. See the help/config file for details on calc_debug.

View File

@@ -13,7 +13,7 @@ DESCRIPTION
This custom function will return the value: This custom function will return the value:
q mod 2^(2^127-1) q mod 2^(2^127-1)
This custom function serves as a demonstration of how to write This custom function serves as a demonstration of how to write
a custom function. It performs the equivalent of: a custom function. It performs the equivalent of:

View File

@@ -79,7 +79,7 @@ EXAMPLE
10 /* 012 */ 10 /* 012 */
; base2(16), ; base2(16),
; 131072 ; 131072
131072 /* 0x20000 */ 131072 /* 0x20000 */
; 2345 ; 2345
2345 /* 0x929 */ 2345 /* 0x929 */
@@ -96,7 +96,7 @@ LINK LIBRARY
SEE ALSO SEE ALSO
base, config, str base, config, str
## Copyright (C) 2002 Landon Curt Noll ## Copyright (C) 2002,2021 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## 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 ## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -866,10 +866,10 @@ DESCRIPTION
when a variable name collides with an exist name of a higher scope. when a variable name collides with an exist name of a higher scope.
Examples of collisions are when: Examples of collisions are when:
* both local and static variables have the same name * both local and static variables have the same name
* both local and global variables have the same name * both local and global variables have the same name
* both function parameter and local variables have the same name * both function parameter and local variables have the same name
* both function parameter and global variables have the same name * both function parameter and global variables have the same name
The initial "redecl_warn" value is 1. The initial "redecl_warn" value is 1.
@@ -895,7 +895,7 @@ EXAMPLE
1 1
; config("version") ; config("version")
"2.12.0" "2.12.0"
; config("all") ; config("all")
mode "real" mode "real"

View File

@@ -31,7 +31,7 @@ DESCRIPTION
The value d will be set as if the following were used: The value d will be set as if the following were used:
d = int(return_value); d = int(return_value);
For some rounding modes, d will be an integer in the interval [0, 360). For some rounding modes, d will be an integer in the interval [0, 360).
For other rounding modes, d will be an integer in the interval (-360, 0]. For other rounding modes, d will be an integer in the interval (-360, 0].
@@ -52,7 +52,7 @@ DESCRIPTION
The following shows relationship between the return value and the resulting The following shows relationship between the return value and the resulting
d, and m values: d, and m values:
return_value == d + m/60; return_value == d + m/60;
EXAMPLE EXAMPLE

View File

@@ -32,7 +32,7 @@ DESCRIPTION
The value d will be set as if the following were used: The value d will be set as if the following were used:
d = int(return_value); d = int(return_value);
For some rounding modes, d will be an integer in the interval [0, 360). For some rounding modes, d will be an integer in the interval [0, 360).
For other rounding modes, d will be an integer in the interval (-360, 0]. For other rounding modes, d will be an integer in the interval (-360, 0].
@@ -67,7 +67,7 @@ DESCRIPTION
The following shows relationship between the return value and the resulting The following shows relationship between the return value and the resulting
d, m, and s values: d, m, and s values:
return_value == d + m/60 + s/3600; return_value == d + m/60 + s/3600;
EXAMPLE EXAMPLE

View File

@@ -73,8 +73,8 @@ EXAMPLE
; for (n = 6; n >= -6; n--) print digit(a, n, 256),; print ; for (n = 6; n >= -6; n--) print digit(a, n, 256),; print
0 0 0 0 1 226 64 201 251 231 108 139 67 0 0 0 0 1 226 64 201 251 231 108 139 67
; for (n = 1; n >= -12; n++) print digit(10/7, n),; print ; for (n = 1; n >= -12; n++) print digit(10/7, n),; print
; 0 1 4 2 8 5 7 1 4 2 8 5 7 1 ; 0 1 4 2 8 5 7 1 4 2 8 5 7 1
; print digit(10/7, -7e1000, 1e6) ; print digit(10/7, -7e1000, 1e6)
428571 428571
@@ -92,7 +92,7 @@ LINK LIBRARY
SEE ALSO SEE ALSO
bit bit
## Copyright (C) 1999-2006 Landon Curt Noll ## Copyright (C) 1999-2006,2021 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## 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 ## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -21,7 +21,7 @@ DESCRIPTION
The builtin function: The builtin function:
display(d) display(d)
display() display()
is an alias for: is an alias for:
@@ -96,7 +96,7 @@ LINK LIBRARY
SEE ALSO SEE ALSO
config, epsilon, fprintf, printf, strprintf config, epsilon, fprintf, printf, strprintf
## Copyright (C) 2004,2018 Landon Curt Noll ## Copyright (C) 2004,2018,2021 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## 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 ## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -38,7 +38,7 @@ DESCRIPTION
(*) NOTE on 'b' / binary/text mode: (*) NOTE on 'b' / binary/text mode:
The 'b' or fopen binary mode has no effect on POSIX / Linux The 'b' or fopen binary mode has no effect on POSIX / Linux
/ Un*x-like systems. On those systems a text file is the / Un*x-like systems. On those systems a text file is the
same as a binary file (as it should be for any modern-day same as a binary file (as it should be for any modern-day
operating system). Adding 'b' to an fopen has no effect operating system). Adding 'b' to an fopen has no effect
@@ -107,7 +107,7 @@ SEE ALSO
fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt, fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt,
fpathopen, strerror fpathopen, strerror
## Copyright (C) 1999-2006 Landon Curt Noll ## Copyright (C) 1999-2006,2021 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## 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 ## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -21,7 +21,7 @@ DESCRIPTION
Absolute filenames, and filenames with an implied path are files Absolute filenames, and filenames with an implied path are files
that begin with: that begin with:
/ # absolute path / # absolute path
./ # implied path through the current working directory ./ # implied path through the current working directory
../ # implied path through the current working directory parent ../ # implied path through the current working directory parent
~ # absolute path going through a home directory ~ # absolute path going through a home directory
@@ -29,12 +29,12 @@ DESCRIPTION
A search path is a :-separated list of directories used to search for A search path is a :-separated list of directories used to search for
a filename. For example: a filename. For example:
fpathopen("whey", "r", ".:/tmp:/var/tmp:~chongo/pub:~/tmp"); fpathopen("whey", "r", ".:/tmp:/var/tmp:~chongo/pub:~/tmp");
will cause this function to open the first readable file it will cause this function to open the first readable file it
files while searching through these paths in order: files while searching through these paths in order:
./whey ./whey
/tmp/whey /tmp/whey
/var/tmp/whey /var/tmp/whey
~chongo/pub/whey ~chongo/pub/whey
@@ -55,7 +55,7 @@ DESCRIPTION
the file "/tmp/log" assuming that the user is not allowed to the file "/tmp/log" assuming that the user is not allowed to
create files in the previous system directories: create files in the previous system directories:
fpathopen("log", "a", "/:/etc:/bin:/usr/bin:/tmp"); fpathopen("log", "a", "/:/etc:/bin:/usr/bin:/tmp");
The CALCPATH search path is taken from the $CALCPATH environment The CALCPATH search path is taken from the $CALCPATH environment
variable or if no such variable exists, a compiled in default search variable or if no such variable exists, a compiled in default search
@@ -92,7 +92,7 @@ DESCRIPTION
(*) NOTE on 'b' / binary/text mode: (*) NOTE on 'b' / binary/text mode:
The 'b' or fopen binary mode has no effect on POSIX / Linux The 'b' or fopen binary mode has no effect on POSIX / Linux
/ Un*x-like systems. On those systems a text file is the / Un*x-like systems. On those systems a text file is the
same as a binary file (as it should be for any modern-day same as a binary file (as it should be for any modern-day
operating system). Adding 'b' to an fopen has no effect operating system). Adding 'b' to an fopen has no effect
@@ -180,7 +180,7 @@ SEE ALSO
fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt, fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt,
environment, calcpath environment, calcpath
## Copyright (C) 2006 Landon Curt Noll ## Copyright (C) 2006,2021 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## 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 ## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -31,7 +31,7 @@ DESCRIPTION
The value g will be set as if the following were used: The value g will be set as if the following were used:
g = int(return_value); g = int(return_value);
For some rounding modes, g will be an integer in the interval [0, 400). For some rounding modes, g will be an integer in the interval [0, 400).
For other rounding modes, g will be an integer in the interval (-400, 0]. For other rounding modes, g will be an integer in the interval (-400, 0].
@@ -52,7 +52,7 @@ DESCRIPTION
The following shows relationship between the return value and the resulting The following shows relationship between the return value and the resulting
g, and m values: g, and m values:
return_value == g + m/60; return_value == g + m/60;
EXAMPLE EXAMPLE

View File

@@ -32,7 +32,7 @@ DESCRIPTION
The value g will be set as if the following were used: The value g will be set as if the following were used:
g = int(return_value); g = int(return_value);
For some rounding modes, g will be an integer in the interval [0, 400). For some rounding modes, g will be an integer in the interval [0, 400).
For other rounding modes, g will be an integer in the interval (-400, 0]. For other rounding modes, g will be an integer in the interval (-400, 0].
@@ -67,7 +67,7 @@ DESCRIPTION
The following shows relationship between the return value and the resulting The following shows relationship between the return value and the resulting
g, m, and s values: g, m, and s values:
return_value == g + m/60 + s/3600; return_value == g + m/60 + s/3600;
EXAMPLE EXAMPLE

View File

@@ -31,7 +31,7 @@ DESCRIPTION
The value h will be set as if the following were used: The value h will be set as if the following were used:
h = int(return_value); h = int(return_value);
For some rounding modes, h will be an integer in the interval [0, 24). For some rounding modes, h will be an integer in the interval [0, 24).
For other rounding modes, h will be an integer in the interval (-24, 0]. For other rounding modes, h will be an integer in the interval (-24, 0].
@@ -52,7 +52,7 @@ DESCRIPTION
The following shows relationship between the return value and the resulting The following shows relationship between the return value and the resulting
h, and m values: h, and m values:
return_value == h + m/60; return_value == h + m/60;
EXAMPLE EXAMPLE

View File

@@ -32,7 +32,7 @@ DESCRIPTION
The value h will be set as if the following were used: The value h will be set as if the following were used:
h = int(return_value); h = int(return_value);
For some rounding modes, h will be an integer in the interval [0, 24). For some rounding modes, h will be an integer in the interval [0, 24).
For other rounding modes, h will be an integer in the interval (-24, 0]. For other rounding modes, h will be an integer in the interval (-24, 0].
@@ -67,7 +67,7 @@ DESCRIPTION
The following shows relationship between the return value and the resulting The following shows relationship between the return value and the resulting
h, m, and s values: h, m, and s values:
return_value == h + m/60 + s/3600; return_value == h + m/60 + s/3600;
EXAMPLE EXAMPLE

View File

@@ -18,7 +18,7 @@ DESCRIPTION
takes into account more abstract concepts such as data types. takes into account more abstract concepts such as data types.
WARNING: Use of FNV-0 is NOT recommended for general purposes. WARNING: Use of FNV-0 is NOT recommended for general purposes.
Calc uses FNV-0 for internal objects such as associative Calc uses FNV-0 for internal objects such as associative
arrays as well as other internal processes. Calc arrays as well as other internal processes. Calc
maintains the use of FNV-0 for backwards compatibility. maintains the use of FNV-0 for backwards compatibility.
@@ -47,7 +47,7 @@ LINK LIBRARY
SEE ALSO SEE ALSO
ishash, fnv, sha1 ishash, fnv, sha1
## Copyright (C) 1999-2007,2014 Landon Curt Noll ## Copyright (C) 1999-2007,2014,2021 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## 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 ## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -13,7 +13,7 @@ What is calc?
and the calculator will print: and the calculator will print:
15 15
Calc has the usual collection of arithmetic operators +, -, /, * Calc has the usual collection of arithmetic operators +, -, /, *
as well as ^ (exponentiation), % (modulus) and // (integer divide). as well as ^ (exponentiation), % (modulus) and // (integer divide).
@@ -27,7 +27,7 @@ What is calc?
Notice that calc values can be very large. For example: Notice that calc values can be very large. For example:
2^23209-1 2^23209-1
will print: will print:
@@ -60,7 +60,7 @@ What is calc?
and the calculator prints: and the calculator prints:
13763753091226345046315979581580902400000000 13763753091226345046315979581580902400000000
The calculator also knows about complex numbers, so that typing: The calculator also knows about complex numbers, so that typing:
@@ -69,7 +69,7 @@ What is calc?
will print: will print:
17+6i 17+6i
-55.50474777265624667147+193.9265235748927986537i -55.50474777265624667147+193.9265235748927986537i
The calculator can calculate transcendental functions, and accept and The calculator can calculate transcendental functions, and accept and
@@ -81,19 +81,19 @@ What is calc?
prints: prints:
0.8414709848078965066525023216302989996225630607983710656727517099919104 0.8414709848078965066525023216302989996225630607983710656727517099919104
Calc can output values in terms of fractions, octal or hexadecimal. Calc can output values in terms of fractions, octal or hexadecimal.
For example: For example:
config("mode", "fraction"), config("mode", "fraction"),
(17/19)^23 (17/19)^23
base(16), base(16),
(19/17)^29 (19/17)^29
will print: will print:
19967568900859523802559065713/257829627945307727248226067259 19967568900859523802559065713/257829627945307727248226067259
0x9201e65bdbb801eaf403f657efcf863/0x5cd2e2a01291ffd73bee6aa7dcf7d1 0x9201e65bdbb801eaf403f657efcf863/0x5cd2e2a01291ffd73bee6aa7dcf7d1
All numbers are represented as fractions with arbitrarily large All numbers are represented as fractions with arbitrarily large

View File

@@ -18,12 +18,12 @@ DESCRIPTION
Note that issq() works on rational values, so: Note that issq() works on rational values, so:
issq(25/16) == 1 issq(25/16) == 1
If you want to test for prefect square integers, you need to exclude If you want to test for prefect square integers, you need to exclude
non-integer values before you test: non-integer values before you test:
isint(curds) && issq(curds) isint(curds) && issq(curds)
EXAMPLE EXAMPLE
; print issq(25), issq(3), issq(0) ; print issq(25), issq(3), issq(0)
@@ -45,7 +45,7 @@ SEE ALSO
isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, isobjtype, isodd, isprime, isrand, israndom, isreal, isrel,
issimple, isstr, istype issimple, isstr, istype
## Copyright (C) 1999 Landon Curt Noll ## Copyright (C) 1999,2021 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## 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 ## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -17,8 +17,8 @@ DESCRIPTION
If y is an odd prime, then the Legendre symbol (x/y) returns: If y is an odd prime, then the Legendre symbol (x/y) returns:
(x/y) == 0 x is divisible by y (0 == x % y) (x/y) == 0 x is divisible by y (0 == x % y)
(x/y) == 1 if x is a quadratic residue modulo y (x/y) == 1 if x is a quadratic residue modulo y
(x/y) == -1 if x is not a quadratic residue modulo y (x/y) == -1 if x is not a quadratic residue modulo y
Legendre symbol often denoted as (x/y) as if x/y were a fraction. Legendre symbol often denoted as (x/y) as if x/y were a fraction.

View File

@@ -25,11 +25,11 @@ TYPES
DESCRIPTION DESCRIPTION
The expression: The expression:
x % y x % y
is equivalent to call: is equivalent to call:
mod(x, y) mod(x, y)
The function: The function:
@@ -37,7 +37,7 @@ DESCRIPTION
is equivalent to: is equivalent to:
config("mod", rnd), x % y config("mod", rnd), x % y
except that the global config("mod") value does not change. except that the global config("mod") value does not change.
@@ -137,7 +137,7 @@ LINK LIBRARY
SEE ALSO SEE ALSO
quo, quomod, //, % quo, quomod, //, %
## Copyright (C) 1999-2006 Landon Curt Noll ## Copyright (C) 1999-2006,2021 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## 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 ## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -85,7 +85,7 @@
The man command is an alias for the help command. Try: The man command is an alias for the help command. Try:
man jacobi man jacobi
Only calc help files may be displayed by the help and man commands. Only calc help files may be displayed by the help and man commands.

View File

@@ -18,7 +18,7 @@ DESCRIPTION
As a unary operator: As a unary operator:
# value # value
returns the number of 1 bits, or pop-count of the absolute value of returns the number of 1 bits, or pop-count of the absolute value of
the numerator (abs(num(value))). Therefore when x is a non-negative the numerator (abs(num(value))). Therefore when x is a non-negative
@@ -52,7 +52,7 @@ DESCRIPTION
For example, of an executable file contains: For example, of an executable file contains:
#!/usr/local/src/bin/calc/calc -q -f #!/usr/local/src/bin/calc/calc -q -f
/* NOTE: The #! above must start in column 1 of the 1st line */ /* NOTE: The #! above must start in column 1 of the 1st line */
/* The 1st line must end with -f */ /* The 1st line must end with -f */
## Single # shell comments don't work, use two or more ## Single # shell comments don't work, use two or more

View File

@@ -14,7 +14,7 @@ DESCRIPTION
Generate a pseudo-random number using an subtractive 100 shuffle generator. Generate a pseudo-random number using an subtractive 100 shuffle generator.
We return a pseudo-random number over the half closed interval: We return a pseudo-random number over the half closed interval:
[min,beyond) ((min <= return < beyond)) [min,beyond) ((min <= return < beyond))
By default, min is 0 and beyond is 2^64. By default, min is 0 and beyond is 2^64.

View File

@@ -14,7 +14,7 @@ DESCRIPTION
Generate a pseudo-random number using a Blum-Blum-Shub generator. Generate a pseudo-random number using a Blum-Blum-Shub generator.
We return a pseudo-random number over the half closed interval: We return a pseudo-random number over the half closed interval:
[min,beyond) ((min <= return < beyond)) [min,beyond) ((min <= return < beyond))
By default, min is 0 and beyond is 2^64. By default, min is 0 and beyond is 2^64.
@@ -159,7 +159,7 @@ LINK LIBRARY
SEE ALSO SEE ALSO
seed, srand, randbit, isrand, rand, srandom, israndom seed, srand, randbit, isrand, rand, srandom, israndom
## Copyright (C) 1999-2007 Landon Curt Noll ## Copyright (C) 1999-2007,2021 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## 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 ## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -302,7 +302,7 @@ Statements
help round help round
See: See:
help builtin help builtin
for a list of builtin functions. for a list of builtin functions.
@@ -321,11 +321,11 @@ Statements
The man command is an alias for the help command. For example: The man command is an alias for the help command. For example:
man jacobi man jacobi
Only calc help files may be displayed by the help and man commands. Only calc help files may be displayed by the help and man commands.
## Copyright (C) 1999-2007,2017 Landon Curt Noll ## Copyright (C) 1999-2007,2017,2021 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## 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 ## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -14,7 +14,7 @@ DESCRIPTION
The stoponerror controls when or if calc stops based on the The stoponerror controls when or if calc stops based on the
number of errors: number of errors:
n == -1 do not stop n == -1 do not stop
n == 0 stop on error unless calc was invoked with -c n == 0 stop on error unless calc was invoked with -c
n > 0 stop when n errors are encountered n > 0 stop when n errors are encountered
@@ -35,7 +35,7 @@ LINK LIBRARY
SEE ALSO SEE ALSO
errcount, errmax, errorcodes, iserror, errno, strerror, newerror errcount, errmax, errorcodes, iserror, errno, strerror, newerror
## Copyright (C) 2006 Landon Curt Noll ## Copyright (C) 2006,2021 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## 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 ## the terms of the version 2.1 of the GNU Lesser General Public License

View File

@@ -18,7 +18,7 @@ DESCRIPTION
EXAMPLE EXAMPLE
; strtolower(" GNU Lesser General Public License"); ; strtolower(" GNU Lesser General Public License");
" gnu lesser general public license" " gnu lesser general public license"
LIMITS LIMITS
none. none.

View File

@@ -18,7 +18,7 @@ DESCRIPTION
EXAMPLE EXAMPLE
; strtoupper(" GNU Lesser General Public License"); ; strtoupper(" GNU Lesser General Public License");
" GNU LESSER GENERAL PUBLIC LICENSE" " GNU LESSER GENERAL PUBLIC LICENSE"
LIMITS LIMITS
none. none.

View File

@@ -73,11 +73,11 @@ Unexpected
Be careful about the precedence of operators. Note that: Be careful about the precedence of operators. Note that:
-1 ^ 0.5 == -1 -1 ^ 0.5 == -1
whereas: whereas:
(-1) ^ 0.5 == 1i (-1) ^ 0.5 == 1i
because the above expression in parsed as: because the above expression in parsed as:
@@ -85,7 +85,7 @@ Unexpected
whereas: whereas:
(-1) ^ 0.5 == 1i (-1) ^ 0.5 == 1i
op= operators associate left to right op= operators associate left to right
@@ -277,7 +277,7 @@ Unexpected
A single # is an calc operator, not a comment. However two or more A single # is an calc operator, not a comment. However two or more
##'s in a row is a comment. See "help pound" for more information. ##'s in a row is a comment. See "help pound" for more information.
#!/usr/local/src/bin/calc/calc -q -f #!/usr/local/src/bin/calc/calc -q -f
/* a correct comment */ /* a correct comment */
## another correct comment ## another correct comment
@@ -289,7 +289,7 @@ Unexpected
This next example is WRONG: This next example is WRONG:
#!/usr/local/src/bin/calc/calc -q -f #!/usr/local/src/bin/calc/calc -q -f
# This is not a calc calc comment because it has only a single # # This is not a calc calc comment because it has only a single #
# You must to start comments with ## or /* # You must to start comments with ## or /*
@@ -350,7 +350,7 @@ Unexpected
In most interactive shells: In most interactive shells:
calc 2 * 3 calc 2 * 3
will frequently produce a "Missing operator" error because the '*' is will frequently produce a "Missing operator" error because the '*' is
evaluated as a "shell glob". To avoid this you must quote or escape evaluated as a "shell glob". To avoid this you must quote or escape
@@ -358,11 +358,11 @@ Unexpected
For example, bash / ksh / sh shell users should use: For example, bash / ksh / sh shell users should use:
calc '2 * 3' calc '2 * 3'
or: or:
calc 2 \* 3 calc 2 \* 3
or some other form of shell meta-character escaping. or some other form of shell meta-character escaping.
@@ -393,7 +393,7 @@ Unexpected
To avoid this problem, use: To avoid this problem, use:
seq 5 | while read i; do calc "($i+3)^2" </dev/null; done seq 5 | while read i; do calc "($i+3)^2" </dev/null; done
which produces the expected results: which produces the expected results:

View File

@@ -12,16 +12,16 @@ DESCRIPTION
Calc version strings can be of the form: Calc version strings can be of the form:
x.y.z.w x.y.z.w
x.y.z x.y.z
x.y x.y
where x, y, z, w, v are integers (without leading 0's) and, where x, y, z, w, v are integers (without leading 0's) and,
t is the literal character 't'. t is the literal character 't'.
EXAMPLE EXAMPLE
; version() ; version()
"2.11.5.4" "2.11.5.4"
LIMITS LIMITS
none none

View File

@@ -1127,7 +1127,7 @@ addreadset(char *name, char *path, struct stat *sbuf)
* like UNIX inodes. _fullpath also allocated the memory for * like UNIX inodes. _fullpath also allocated the memory for
* this new longer path name. * this new longer path name.
*/ */
{ {
readset[ret].path = _fullpath(NULL, path, MSDOS_MAX_PATH); readset[ret].path = _fullpath(NULL, path, MSDOS_MAX_PATH);
if (readset[ret].path == NULL) { if (readset[ret].path == NULL) {
return -1; return -1;

View File

@@ -673,7 +673,7 @@ qdigit(NUMBER *q, ZVALUE dpos, ZVALUE base)
/* /*
* In the first stage, q is expressed as base^k * N/D where * In the first stage, q is expressed as base^k * N/D where
* gcd(D, base) = 1 * gcd(D, base) = 1
* K is k as a ZVALUE * K is k as a ZVALUE
*/ */
base.sign = 0; base.sign = 0;
if (ziszero(base) || zisunit(base)) if (ziszero(base) || zisunit(base))

4
str.c
View File

@@ -939,9 +939,9 @@ stringcaserel(STRING *s1, STRING *s2)
c2++; c2++;
} }
if ( (tolower(*c1)) > (tolower(*c2))) if ( (tolower(*c1)) > (tolower(*c2)))
return 1; return 1;
if ( (tolower(*c1)) < (tolower(*c2))) if ( (tolower(*c1)) < (tolower(*c2)))
return -1; return -1;
if (i1 < i2) return -1; if (i1 < i2) return -1;
return (i1 > i2); return (i1 > i2);
} }

View File

@@ -79,7 +79,7 @@ char *Copyright = "\n"
"calc - arbitrary precision calculator\n" "calc - arbitrary precision calculator\n"
"\n" "\n"
"Copyright (C) 1999-2021 David I. Bell, Landon Curt Noll " "Copyright (C) 1999-2021 David I. Bell, Landon Curt Noll "
"and Ernest Bowen\n" "and Ernest Bowen\n"
"\n" "\n"
"Initial author: David I. Bell\n" "Initial author: David I. Bell\n"
"\n" "\n"