/usr/share/calc/help/type is in apcalc-common 2.12.4.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | Builtin types
The calculator has the following built-in types.
null value
This is the undefined value type. The function 'null'
returns this value. Functions which do not explicitly
return a value return this type. If a function is called
with fewer parameters than it is defined for, then the
missing parameters have the null type. The null value is
false if used in an IF test.
rational numbers
This is the basic data type of the calculator.
These are fractions whose numerators and denominators
can be arbitrarily large. The fractions are always
in lowest terms. Integers have a denominator of 1.
The numerator of the number contains the sign, so that
the denominator is always positive. When a number is
entered in floating point or exponential notation, it is
immediately converted to the appropriate fractional value.
Printing a value as a floating point or exponential value
involves a conversion from the fractional representation.
Numbers are stored in binary format, so that in general,
bit tests and shifts are quicker than multiplies and divides.
Similarly, entering or displaying of numbers in binary,
octal, or hex formats is quicker than in decimal. The
sign of a number does not affect the bit representation
of a number.
complex numbers
Complex numbers are composed of real and imaginary parts,
which are both fractions as defined above. An integer which
is followed by an 'i' character is a pure imaginary number.
Complex numbers such as "2+3i" when typed in, are processed
as the sum of a real and pure imaginary number, resulting
in the desired complex number. Therefore, parenthesis are
sometimes necessary to avoid confusion, as in the two values:
1+2i ^2 (which is -3)
(1+2i) ^2 (which is -3+4i)
Similar care is required when entering fractional complex
numbers. Note the differences below:
3/4i (which is -(3/4)i)
3i/4 (which is (3/4)i)
The imaginary unit itself is input using "1i".
strings
Strings are a sequence of zero or more characters.
They are input using either of the single or double
quote characters. The quote mark which starts the
string also ends it. Various special characters can
also be inserted using back-slash. Example strings:
"hello\n"
"that's all"
'lots of """"'
'a'
""
There is no distinction between single character and
multi-character strings. The 'str' and 'ord' functions
will convert between a single character string and its
numeric value. The 'str' and 'eval' functions will
convert between longer strings and the corresponding
numeric value (if legal). The 'strcat', 'strlen', and
'substr' functions are also useful.
matrices
These are one to four dimensional matrices, whose minimum
and maximum bounds can be specified at runtime. Unlike C,
the minimum bounds of a matrix do not have to start at 0.
The elements of a matrix can be of any type. There are
several built-in functions for matrices. Matrices are
created using the 'mat' statement.
associations
These are one to four dimensional matrices which can be
indexed by arbitrary values, instead of just integers.
These are also known as associative arrays. The elements of
an association can be of any type. Very few operations are
permitted on an association except for indexing. Associations
are created using the 'assoc' function.
lists
These are a sequence of values, which are linked together
so that elements can be easily be inserted or removed
anywhere in the list. The values can be of any type.
Lists are created using the 'list' function.
files
These are text files opened using stdio. Files may be opened
for sequential reading, writing, or appending. Opening a
file using the 'fopen' function returns a value which can
then be used to perform I/O to that file. File values can
be copied by normal assignments between variables, or by
using the result of the 'files' function. Such copies are
indistinguishable from each other.
## Copyright (C) 1999 Landon Curt Noll
##
## 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
## as published by the Free Software Foundation.
##
## Calc is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
## Public License for more details.
##
## A copy of version 2.1 of the GNU Lesser General Public License is
## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## @(#) $Revision: 30.1 $
## @(#) $Id: types,v 30.1 2007/03/16 11:10:42 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/types,v $
##
## Under source code control: 1991/07/21 04:37:24
## File existed as early as: 1991
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|