Calc is an interactive calculator which provides for easy large numeric calculations, but which also can be easily programmed for difficult or long calculations.
It can accept a command line argument, in which case it executes that single command and exits. Otherwise, it enters interactive mode.
In this mode, it accepts commands one at a time, processes them, and displays the answers. In the simplest case, commands are simply expressions which are evaluated. For example, the following line can be input:
3 * (4 + 1)
and the calculator will print:
All numbers are represented as fractions with arbitrarily large numerators and denominators which are always reduced to lowest terms. Real or exponential format numbers can be input and are converted to the equivalent fraction. Hex, binary, or octal numbers can be input by using numbers with leading '0x', '0b' or '0' characters. Complex numbers can be input using a trailing 'i', as in '2+3i'. Strings and characters are input by using single or double quotes.
Commands are statements in a C-like language, where each input line is treated as the body of a procedure. Thus the command line can contain variable declarations, expressions, labels, conditional tests, and loops. Assignments to any variable name will automatically define that name as a global variable.
The other important thing to know is that all non-assignment expressions which are evaluated are automatically printed. Thus, you can evaluate an expression's value by simply typing it in.
Many useful built-in mathematical functions are available. Use the:
command to list them.
Useful calc links:
- Downloading calc source
- calc source mirror sites
- What is calc?
- What are some of the calc builtin functions?
- Who wrote calc?
- Keep current by joining the calc mailing list.
- Report calc bugs and/or submit calc bug fix patches via the calc EMail address
- Visit calc's SourceForge project page.
If are interested in algorithms for finding very large primes:Some of the methods used by the Amdahl 6 to discover (what was at the time of discovery, the largest known non-Mersenne prime): (391581*2^216193-1) are contained in the calc script lucas.cal. This calc script is available as part of calc distribution.
If are interested the product of curious primes:See the curious calc web page.
Calc is freeThe calc program is free. It is distributed under the GNU Lesser General Public License.
Calc is open software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation version 2.1 of the License.
Many people have expressed their thanks the many people who wrote calc, tested calc, contributed code to calc, patched calc, and helped to improve it since it started back in 1984.
We, the authors of calc wrote calc because they wanted to write it, because it was fun writing it, and because we wanted you to use and enjoy it.
If you use and enjoy calc, and you want to show your appreciation for calc, you might consider doing some of the following:
- Write and contribute some .cal resource files
- Write and contribute some calc shell scripts
- Work on one of the calc TODO items (type "help todo")
Download & Install.
Calc mirror sites will find the following special files:
- calc-*.i686.rpm: installs calc executable & shared libraries
- calc-devel-*.i686.rpm: installs headers, static executable & static libraries
- calc-*.src.rpm: calc src as an rpm
- calc-debuginfo-*.i686.rpm: non-stripped executable & libraries suitable for advanced debugging
- *_IS_LATEST_STABLE: indicates the most recent stable version
- *_IS_LATEST_UNSTABLE: indicates the most recent beta-test version
- HOWTO.INSTALL: How to install from the calc gziped tarball in 4 easy steps
- README: general download notes
- CHANGES: changes made as of most recently built version
- COPYING: calc GNU Lesser General Public License information
- COPYING-LGPL: GNU Lesser General Public License
- checksum.*: a checksum of the various calc tarballs
- what-is-calc: A brief explanation of calc
If you liked this article, subscribe to the feed by clicking the image below to keep informed about new contents of the blog: