tcalc(1)
π NAME π
tcalc β The terminal calculator β¨
(yes bestie, this is the tcalc(1) man page β the tcalc man page, no cap β and we're gonna read it together π«Ά)
π SYNOPSIS π
tcalc [OPTIONS] [file-name]
π§ DESCRIPTION π§
okay so bestie, tcalc β the terminal calculator β is a small and helpful program that helps users of the GNU/Linux terminal do calculations simply and quickly π
. The formula you wanna calculate can be fed to tcalc straight through the command line. OR, alternatively, tcalc can be run with no formula at all, and then free mode starts, in which the calculator will just wait for your input, do the necessary calculations and print out the result, and then the cycle repeats π until you enter 'q' or 'quit' π.
The calculator works with the decimal, hexadecimal, octal, and binary number systems π¦. It automatically identifies hex numbers if entered with a preceding "0x" or "0X", octal by preceding the number with a zero, binaries by preceding the number with 'b' and decimals by absence of all of the above β¨. Alternatively, you the user can indicate the type of input by setting the 'format' argument (See below).
Math functions defined are:
acos(x)β Arc cosine of Xasin(x)β Arc sine of Xatan(x)β Arc tangent of Xatan2(y, x)β Arc tangent of Y/Xcos(x)β Cosine of Xsin(x)β Sine of Xtan(x)β Tangent of Xcosh(x)β Hyperbolic cosine of Xsinh(x)β Hyperbolic sine of Xtanh(x)β Hyperbolic tangent of Xacosh(x)β Hyperbolic arc cosine of Xasinh(x)β Hyperbolic arc sine of Xatanh(x)β Hyperbolic arc tangent of Xexp(x)β Exponential function of Xlog(x)β Natural logarithm of Xlog10(x)β Base-ten logarithm of Xpow(x, y)β X to the power Ysqrt(x)β Square root of Xcbrt(x)β Cube root of Xceil(x)β Smallest integral value not less than Xfloor(x)β Largest integer not greater than Xfabs(x)β Absolute value of Xround(x)β Round X to nearest integral value, rounding halfway cases away from zerotrunc(x)β Round X to the integral value in floating-point format nearest but not larger in magnitude
These functions can be called within a formula π«Ά. And if you want a printout of the above list, use the "-m" or "--math" flags (see below).
π The free mode π
If you start tcalc with no command line formula and no input file, this will invoke free mode β¨. You will see a '>' prompt indicating this mode. Enter your formulas one by one, ending each one with an ENTER, and tcalc will process the formula and output the result π. You can enter other commands like
(yes bestie, that sentence just... ends there in the original. iconic of it, honestly π)
π¦ User-defined functions π¦
To define a user function, invoke tcalc with no formulas or input files (you can pass arguments like 'output' or 'decimal'), and then enter at the prompt:
> func your-function-name(list of arguments)
The prompt will change to '->' indicating you are in function definition mode π§. To exit this mode, type 'q' or 'quit'. Function names are currently limited to ten characters length π. If you don't want to pass arguments to the function, ignore the list of arguments and the braces, just type 'func your-function-name' and press enter. Of course you will substitute 'your-function-name' with the actual name of the function! π
If defining functions in files, you should enclose the function body with curly braces, as:
func myfunc
{
statement-1
statement-2
...
}
other statements...
You can also define variables inside functions π«Ά. By default, variables are initiated for the number of arguments you specify in the function declaration. If you need to declare other variables, use the 'var' command from the free mode or from inside a formula file π. Note that variable names are strictly composed of lower-case latin letters "a"-"z", and must not start with a "b" (as tcalc uses this letter to identify binary numbers!) π.
πΈ Input files πΈ
The calculator also supports input through pretyped files π. Use the '-i' or function definitions and formulas to be calculated. The tcalc will process the file and output the results β¨. Files can contain comments. Commented line is defined as a line that starts with a hash (#). Tcalc will ignore any lines in which the hash appears. A sample file is installed with the package in the If you intend to pass your input file to the calculator through redirection (i.e. 'tcalc < test' if your file name is 'test') you should end your file with 'end' or 'quit' so the calculator will know where the input stops, otherwise it will enter an infinite loop, repeating the last command for ever! ππ₯
π OPTIONS π
Formulaβ Formula to be calculated. Examples:
5+4
0xff*0x23
b111-b01
7*0xf
(6+5)*7
... and so on
-c,--convert nβ Convertnto the output format specified by-obelow, or to decimal if no format is specified π-d,--decimal nβ How many digits are shown to the right of the decimal point π’-f,--format nβ Input format, possible values are:binary(b)hex(x)decimal(d)octal(o)
Input format is usually automatically identified β¨. This feature is provided only for convenience.
-h,--helpβ Print command line help π-i,--input file-nameβ Name of file containing formulas (under development) π§-m,--mathβ Print a list of math functions π-o,--output nβ Output format, possible values are:binary(b)hex(x)decimal(d)octal(o)- all formats (
a)
Default output format is decimal, which will be used if -o option is not used.
-q,--quietβ Minimize output messages π€«-t,--table nβ Print the multiplication table of numbernβοΈ-v,--versionβ Display program version and exit π
π FILES π
file-nameβ The name of the file containing formulas to be calculated.
π§ TODO π§
- Testing and debugging
π SEE ALSO π
info tcalc
π AUTHOR π
Mohammed Isam <mohammed_isam1984@yahoo.com>
and that's the whole thing, bestie π«Ά this was version 2.1, dated SEPTEMBER 2016 β go forth and calculate, you absolute icon πβ¨π
π¦ where this page comes from
- fedora 43: tcalc 2.1-21.fc41 Β· GPL-3.0-or-later
- fedora 43: tcalc 2.1-25.fc43 Β· GPL-3.0-or-later
- fedora 44: tcalc 2.1-25.fc44 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms