"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cscript/powerterm.calc" between
calc-2.12.7.2.tar.bz2 and calc-2.12.7.6.tar.bz2

About: Calc is a C-style arbitrary precision calculator.

powerterm.calc  (calc-2.12.7.2.tar.bz2):powerterm.calc  (calc-2.12.7.6.tar.bz2)
#!/usr/local/src/bin/calc/calc -q -s -f #!/usr/local/src/bin/calc/calc -q -s -f
/* /*
* powerterm - print the argument as a sum of powers of integers * powerterm - print the argument as a sum of powers of integers
* *
* usage: * usage:
* powerterm [base_limit] value * powerterm [base_limit] value
* *
* base_limit largest base we will consider (def: 10000) * base_limit largest base we will consider (def: 10000)
* value value to convert into sums of powers of integers * value value to convert into sums of powers of integers
* *
* Copyright (C) 2001,2014 Landon Curt Noll * Copyright (C) 2001,2014,2019 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 powerterm of the version 2.1 of the GNU Lesser General Public License * the powerterm of the version 2.1 of the GNU Lesser General Public License
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* Calc is distributed in the hope that it will be useful, but WITHOUT * Calc is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 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. * Public License for more details.
* *
skipping to change at line 37 skipping to change at line 37
* Under source code control: 2001/04/24 23:49:11 * Under source code control: 2001/04/24 23:49:11
* File existed as early as: 2001 * File existed as early as: 2001
* *
* 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/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*
* parse args * parse args
*/ */
argc = argv();
stderr = files(2);
program = argv(0);
config("verbose_quit", 0),; config("verbose_quit", 0),;
base_lim = 10000; /* default: highest base we will consider */ base_lim = 10000; /* default: highest base we will consider */
if (argv() < 2 || argv() > 3) { if (argc < 2 || argc > 3) {
fprintf(files(2), "usage: %s [base_limit] value\n", argv(0)); fprintf(stderr, "usage: %s [base_limit] value\n", program);
exit; exit;
} }
if (argv() == 3) { if (argc == 3) {
x = eval(argv(2)); x = eval(argv(2));
base_lim = eval(argv(1)); base_lim = eval(argv(1));
} else { } else {
x = eval(argv(1)); x = eval(argv(1));
} }
if (! isint(x)) { if (! isint(x)) {
fprintf(files(2), "%s: value must be an integer\n"); fprintf(stderr, "%s: value must be an integer\n", program);
exit; exit;
} }
if (! isint(base_lim)) { if (! isint(base_lim)) {
fprintf(files(2), "%s: base limit must be an integer\n"); fprintf(stderr, "%s: base limit must be an integer\n", program);
exit; exit;
} }
if (base_lim <= 1) { if (base_lim <= 1) {
fprintf(files(2), "%s: base limit is too small\n"); fprintf(stderr, "%s: base limit is too small\n", program);
exit; exit;
} }
++base_lim; ++base_lim;
/* /*
* setup loop variables * setup loop variables
*/ */
term = 0; /* number of powerterm found */ term = 0; /* number of powerterm found */
/* /*
 End of changes. 7 change blocks. 
7 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)