intro (calc-2.12.7.2.tar.bz2) | : | intro (calc-2.12.7.6.tar.bz2) | ||
---|---|---|---|---|

skipping to change at line 18 | skipping to change at line 18 | |||

commands one at a time, processes them, and displays the answers. | commands one at a time, processes them, and displays the answers. | |||

In the simplest case, commands are simply expressions which are | In the simplest case, commands are simply expressions which are | |||

evaluated. For example, the following line can be input: | evaluated. For example, the following line can be input: | |||

3 * (4 + 1) | 3 * (4 + 1) | |||

and the calculator will print: | and the calculator will print: | |||

15 | 15 | |||

Calc as 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). | |||

For example: | For example: | |||

3 * 19^43 - 1 | 3 * 19^43 - 1 | |||

will produce: | will produce: | |||

29075426613099201338473141505176993450849249622191102976 | 29075426613099201338473141505176993450849249622191102976 | |||

Notice that calc values can be very large. For example: | Notice that calc values can be very large. For example: | |||

skipping to change at line 140 | skipping to change at line 140 | |||

ans = 1; | ans = 1; | |||

while (n > 1) | while (n > 1) | |||

ans *= (n -= 2); | ans *= (n -= 2); | |||

return ans; | return ans; | |||

} | } | |||

Thus the input: | Thus the input: | |||

f2(79) | f2(79) | |||

will produce; | will produce: | |||

1009847364737869270905302433221592504062302663202724609375 | 1009847364737869270905302433221592504062302663202724609375 | |||

Functions which only need to return a simple expression can be defined | Functions which only need to return a simple expression can be defined | |||

using an equals sign, as in the example: | using an equals sign, as in the example: | |||

define sc(a,b) = a^3 + b^3 | define sc(a,b) = a^3 + b^3 | |||

Thus the input: | Thus the input: | |||

sc(31, 61) | sc(31, 61) | |||

will produce; | will produce: | |||

256772 | 256772 | |||

Variables in functions can be defined as either 'global', 'local', | Variables in functions can be defined as either 'global', 'local', | |||

or 'static'. Global variables are common to all functions and the | or 'static'. Global variables are common to all functions and the | |||

command line, whereas local variables are unique to each function | command line, whereas local variables are unique to each function | |||

level, and are destroyed when the function returns. Static variables | level, and are destroyed when the function returns. Static variables | |||

are scoped within single input files, or within functions, and are | are scoped within single input files, or within functions, and are | |||

never destroyed. Variables are not typed at definition time, but | never destroyed. Variables are not typed at definition time, but | |||

dynamically change as they are used. | dynamically change as they are used. | |||

End of changes. 3 change blocks. | ||||

3 lines changed or deleted | | 3 lines changed or added |