1tcalc(1)                        tcalc man page                        tcalc(1)
2
3
4

NAME

6       tcalc - The terminal calculator
7

SYNOPSIS

9       tcalc [OPTIONS] [file-name]
10

DESCRIPTION

12       The terminal calculator is a small and helpful program to help users of
13       the GNU/Linux terminal do calculations simply and quickly. The  formula
14       to be calculated can be fed to tcalc through the command line. Alterna‐
15       tively, tcalc can be run with no formula and  then  the  free  mode  is
16       started,  in which the calculator will wait for user input, do the nec‐
17       essary calculations and print out the result, and the cycle will repeat
18       until the user enters 'q' or 'quit'.
19
20       The  calculator  works with the decimal, hexadecimal, octal, and binary
21       number systems. It automatically identifies hex numbers if entered with
22       a  preceding  "0x"  or "0X", octal by preceding the number with a zero,
23       binaries by preceding the number with 'b' and decimals  by  absence  of
24       all  of  the  above.   Alternatively, the user can indicate the type of
25       input by setting the 'format' argument (See below).
26
27       Math functions defined are:
28       ---------------------------
29         acos(x)        Arc cosine of X
30         asin(x)        Arc sine of X
31         atan(x)        Arc tangent of X
32         atan2(y, x)    Arc tangent of Y/X
33         cos(x)         Cosine of X
34         sin(x)         Sine of X
35         tan(x)         Tangent of X
36         cosh(x)        Hyperbolic cosine of X
37         sinh(x)        Hyperbolic sine of X
38         tanh(x)        Hyperbolic tangent of X
39         acosh(x)       Hyperbolic arc cosine of X
40         asinh(x)       Hyperbolic arc sine of X
41         atanh(x)       Hyperbolic arc tangent of X
42         exp(x)         Exponential function of X
43         log(x)         Natural logarithm of X
44         log10(x)       Base-ten logarithm of X
45         pow(x, y)      X to the power Y
46         sqrt(x)        Square root of X
47         cbrt(x)        Cube root of X
48         ceil(x)        Smallest integral value not less than X
49         floor(x)       Largest integer not greater than X
50         fabs(x)        Absolute value of X
51         round(x)       Round X to nearest integral  value,  rounding  halfway
52       cases away
53                        from zero
54         trunc(x)       Round X to the integral value in floating-point format
55       nearest
56                        but not larger in magnitude
57       These functions can be called within a formula. to have a  printout  of
58       the above list, use the "-m" or "--math" flags (see below).
59
60       The free mode:
61       --------------
62       If you start tcalc with no command line formula and no input file, this
63       will invoke the free mode. You will see a '>'  prompt  indicating  this
64       mode.  Enter  your  formulas one by one, ending each one with an ENTER,
65       and tcalc will process the formula and output the result. You can enter
66       other commands like
67
68       User-defined functions:
69       -----------------------
70       To define a user function, invoke tcalc with no formulas or input files
71       (you can pass arguments like 'output' or 'decimal'), and then enter  at
72       the prompt:
73
74       > func your-function-name(list of arguments)
75
76       The  prompt  will change to '->' indicating you are in function defini‐
77       tion mode.  To exit this mode, type 'q' or 'quit'. Function  names  are
78       currently  limited  to ten characters length. If you don't want to pass
79       arguments to the function, ignore the list of arguments and the braces,
80       just type 'func your-function-name' and press enter. Of course you will
81       substitute 'your-function-name' with the actual name of the function!.
82
83       If defining functions in files, you should enclose  the  function  body
84       with curly braces, as:
85
86       func myfunc
87       {
88         statement-1
89         statement-2
90         ...
91       }
92       other statements...
93
94       You  can  also define variables inside functions. By default, variables
95       are initiated for the number of arguments you specify in  the  function
96       declaration.   If  you  need  to declare other variables, use the 'var'
97       command from the free mode or from inside a  formula  file.  Note  that
98       variable  names  are  strictly  composed  of  lower-case  latin letters
99       "a"-"z", and must not start with a "b" (as tcalc uses  this  letter  to
100       identify binary numbers!).
101
102       Input files:
103       ------------
104       The calculator also supports input through pretyped files. Use the '-i'
105       or function definitions and formulas to be calculated. The  tcalc  will
106       process  the  file  and output the results. Files can contain comments.
107       Commented line is defined as a line that starts with a hash (#).  Tcalc
108       will  ignore  any  lines  in  which  the hash appears. A sample file is
109       installed with the package in the If you intend to pass your input file
110       to the calculator through redirection (i.e. 'tcalc < test' if your file
111       name is 'test') you should end your file with 'end' or  'quit'  so  the
112       calculator  will know where the input stops, otherwise it will enter an
113       infinite loop, repeating the last command for ever!.
114
115

OPTIONS

117       Formula
118              Formula to be calculated. Examples:
119                5+4
120                0xff*0x23
121                b111-b01
122                7*0xf
123                (6+5)*7
124                ... and so on
125
126
127       -c, --convert n
128              Convert n to the output format specified by '-o'  below,  or  to
129              decimal if no format is specified
130
131
132       -d, --decimal n
133              How many digits are shown to the right of the decimal point
134
135
136       -f, --format n
137              Input format, possible values are:
138                 * binary (b)
139                 * hex (x)
140                 * decimal (d)
141                 * octal (o)
142              Input  format  is usually automatically identified. This feature
143              is provided only for convenience.
144
145
146       -h, --help
147              Print command line help
148
149
150       -i, --input file-name
151              Name of file containing formulas (under development)
152
153
154       -m, --math
155              Print a list of math functions
156
157
158       -o, --output n
159              Output format, possible values are:
160                 * binary (b)
161                 * hex (x)
162                 * decimal (d)
163                 * octal (o)
164                 * all formats (a)
165              Default output format is decimal, which will  be  used  if  '-o'
166              option is not used.
167
168
169       -q, --quiet
170              Minimize output messages
171
172
173       -t, --table n
174              Print the multiplication table of number 'n'
175
176
177       -v, --version
178              Display program version and exit
179
180

FILES

182       file-name The name of the file containing formulas to be calculated.
183
184

TODO

186       - Testing and debugging
187
188

SEE ALSO

190       info tcalc
191
192

AUTHOR

194       Mohammed Isam <mohammed_isam1984@yahoo.com>
195
196
197
1982.1                             SEPTEMBER 2016                        tcalc(1)
Impressum