"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "cscript/square.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.

square.calc  (calc-2.12.7.2.tar.bz2):square.calc  (calc-2.12.7.6.tar.bz2)
#!/usr/local/src/bin/calc/calc -q -f #!/usr/local/src/bin/calc/calc -q -s -f
/* /*
* sqaure - print the squares of input values * sqaure - print the squares of input values
* *
* Copyright (C) 2000-2007,2014 Ernest Bowen * Copyright (C) 2000-2007,2014,2019 Ernest Bowen
* *
* 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
* 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 36 skipping to change at line 36
/* /*
* Usage: * Usage:
* *
* From the shell: * From the shell:
* *
* ./square * ./square
* cat file | ./square * cat file | ./square
* echo "123" | ./square * echo "123" | ./square
* *
* Within calc:
*
* > read square
*
* With input from a terminal, there is no prompt but each non-empty * With input from a terminal, there is no prompt but each non-empty
* line of input is evaluated as a calc expression and if it can be * line of input is evaluated as a calc expression and if it can be
* calculated, the square of the value of that expression is displayed. * calculated, the square of the value of that expression is displayed.
* Execution stops when an empty line is input. * Execution stops when an empty line is input.
* *
* From the shell: * From the shell:
* *
* ./square * ./square
* *
* The following shows lines of input followed by output: * The following shows lines of input followed by output:
skipping to change at line 61 skipping to change at line 57
* 1234 * 1234
* 1522756 * 1522756
* ln(2) * ln(2)
* ~.48045301391820142467 * ~.48045301391820142467
* config("mode","frac"), bernoulli(10) * config("mode","frac"), bernoulli(10)
* 25/4356 * 25/4356
* config("mode", "hex"), 0xff * config("mode", "hex"), 0xff
* 0xfe01 * 0xfe01
*/ */
global s; while (s = fgetline(files(0))) {
while ((s = prompt("")))
print "\t":eval(s)^2; print "\t":eval(s)^2;
}
 End of changes. 5 change blocks. 
8 lines changed or deleted 3 lines changed or added

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