home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
gnu
/
info
/
calc.info-11
(
.txt
)
< prev
next >
Wrap
GNU Info File
|
1994-12-22
|
51KB
|
869 lines
This is Info file calc.info, produced by Makeinfo-1.55 from the input
file calc.texinfo.
This file documents Calc, the GNU Emacs calculator.
Copyright (C) 1990, 1991 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the section entitled "GNU General Public License" is included
exactly as in the original, and provided that the entire resulting
derived work is distributed under the terms of a permission notice
identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the section entitled "GNU General Public License"
may be included in a translation approved by the author instead of in
the original English.
File: calc.info, Node: Functions for Declarations, Prev: Kinds of Declarations, Up: Declarations
Functions for Declarations
--------------------------
Calc has a set of functions for accessing the current declarations in a
convenient manner. These functions return 1 if the argument can be
shown to have the specified property, or 0 if the argument can be shown
*not* to have that property; otherwise they are left unevaluated.
These functions are suitable for use with rewrite rules (*note
Conditional Rewrite Rules::.) or programming constructs (*note
Conditionals in Macros::.). They can be entered only using algebraic
notation. *Note Logical Operations::, for functions that perform other
tests not related to declarations.
For example, `dint(17)' returns 1 because 17 is an integer, as do
`dint(n)' and `dint(2 n - 3)' if `n' has been declared `int', but
`dint(2.5)' and `dint(n + 0.5)' return 0. Calc consults knowledge of
its own built-in functions as well as your own declarations:
`dint(floor(x))' returns 1.
The `dint' function checks if its argument is an integer. The
`dnatnum' function checks if its argument is a natural number, i.e., a
nonnegative integer. The `dnumint' function checks if its argument is
numerically an integer, i.e., either an integer or an integer-valued
float. Note that these and the other data type functions also accept
vectors or matrices composed of suitable elements, and that real
infinities `inf' and `-inf' are considered to be integers for the
purposes of these functions.
The `drat' function checks if its argument is rational, i.e., an
integer or fraction. Infinities count as rational, but intervals and
error forms do not.
The `dreal' function checks if its argument is real. This includes
integers, fractions, floats, real error forms, and intervals.
The `dimag' function checks if its argument is imaginary, i.e., is
mathematically equal to a real number times `i'.
The `dpos' function checks for positive (but nonzero) reals. The
`dneg' function checks for negative reals. The `dnonneg' function
checks for nonnegative reals, i.e., reals greater than or equal to
zero. Note that the `a s' command can simplify an expression like `x >
0' to 1 or 0 using `dpos', and that `a s' is effectively applied to all
conditions in rewrite rules, so the actual functions `dpos', `dneg',
and `dnonneg' are rarely necessary.
The `dnonzero' function checks that its argument is nonzero. This
includes all nonzero real or complex numbers, all intervals that do not
include zero, all nonzero modulo forms, vectors all of whose elements
are nonzero, and variables or formulas whose values can be deduced to
be nonzero. It does not include error forms, since they represent
values which could be anything including zero. (This is also the set
of objects considered "true" in conditional contexts.)
The `deven' function returns 1 if its argument is known to be an
even integer (or integer-valued float); it returns 0 if its argument is
known not to be even (because it is known to be odd or a non-integer).
The `a s' command uses this to simplify a test of the form `x % 2 = 0'.
There is also an analogous `dodd' function.
The `drange' function returns a set (an interval or a vector of
intervals and/or numbers; *note Set Operations::.) that describes the
set of possible values of its argument. If the argument is a variable
or a function with a declaration, the range is copied from the
declaration. Otherwise, the possible signs of the expression are
determined using a method similar to `dpos', etc., and a suitable set
like `[0 .. inf]' is returned. If the expression is not provably real,
the `drange' function remains unevaluated.
The `dscalar' function returns 1 if its argument is provably scalar,
or 0 if its argument is provably non-scalar. It is left unevaluated if
this cannot be determined. (If matrix mode or scalar mode are in
effect, this function returns 1 or 0, respectively, if it has no other
information.) When Calc interprets a condition (say, in a rewrite
rule) it considers an unevaluated formula to be "false." Thus,
`dscalar(a)' is "true" only if `a' is provably scalar, and
`!dscalar(a)' is "true" only if `a' is provably non-scalar; both are
"false" if there is insufficient information to tell.
File: calc.info, Node: Display Modes, Next: Language Modes, Prev: Declarations, Up: Mode Settings
Display Modes
=============
The commands in this section are two-key sequences beginning with the
`d' prefix. The `d l' (`calc-line-numbering') and `d b'
(`calc-line-breaking') commands are described elsewhere; *note Stack
Basics::. and *note Normal Language Modes::., respectively. Display
formats for vectors and matrices are also covered elsewhere; *note
Vector and Matrix Formats::..
One thing all display modes have in common is their treatment of the
`H' prefix. This prefix causes any mode command that would normally
refresh the stack to leave the stack display alone. The word "Dirty"
will appear in the mode line when Calc thinks the stack display may not
reflect the latest mode settings.
The `d RET' (`calc-refresh-top') command reformats the top stack
entry according to all the current modes. Positive prefix arguments
reformat the top N entries; negative prefix arguments reformat the
specified entry, and a prefix of zero is equivalent to `d SPC'
(`calc-refresh'), which reformats the entire stack. For example, `H d
s M-2 d RET' changes to scientific notation but reformats only the top
two stack entries in the new mode.
The `I' prefix has another effect on the display modes. The mode is
set only temporarily; the top stack entry is reformatted according to
that mode, then the original mode setting is restored. In other words,
`I d s' is equivalent to `H d s d RET H d (OLD MODE)'.
* Menu:
* Radix Modes::
* Grouping Digits::
* Float Formats::
* Complex Formats::
* Fraction Formats::
* HMS Formats::
* Date Formats::
* Truncating the Stack::
* Justification::
* Labels::
File: calc.info, Node: Radix Modes, Next: Grouping Digits, Prev: Display Modes, Up: Display Modes
Radix Modes
-----------
Calc normally displays numbers in decimal ("base-10" or "radix-10")
notation. Calc can actually display in any radix from two (binary) to
36. When the radix is above 10, the letters `A' to `Z' are used as
digits. When entering such a number, letter keys are interpreted as
potential digits rather than terminating numeric entry mode.
The key sequences `d 2', `d 8', `d 6', and `d 0' select binary,
octal, hexadecimal, and decimal as the current display radix,
respectively. Numbers can always be entered in any radix, though the
current radix is used as a default if you press `#' without any initial
digits. A number entered without a `#' is *always* interpreted as
decimal.
To set the radix generally, use `d r' (`calc-radix') and enter an
integer from 2 to 36. You can specify the radix as a numeric prefix
argument; otherwise you will be prompted for it.
Integers normally are displayed with however many digits are
necessary to represent the integer and no more. The `d z'
(`calc-leadi