Next: Calc Mode Line, Previous: Language Modes, Up: Mode Settings [Contents][Index]

`Modes`

VariableThe `m g` (`calc-get-modes`

) command pushes onto the stack
a vector of numbers that describes the various mode settings that
are in effect. With a numeric prefix argument, it pushes only the
`n`th mode, i.e., the `n`th element of this vector. Keyboard
macros can use the `m g` command to modify their behavior based
on the current mode settings.

The modes vector is also available in the special variable
`Modes`

. In other words, `m g` is like `s r Modes RET`.
It will not work to store into this variable; in fact, if you do,
`Modes`

will cease to track the current modes. (The `m g`
command will continue to work, however.)

In general, each number in this vector is suitable as a numeric
prefix argument to the associated mode-setting command. (Recall
that the `~` key takes a number from the stack and gives it as
a numeric prefix to the next command.)

The elements of the modes vector are as follows:

- Current precision. Default is 12; associated command is
`p`. - Binary word size. Default is 32; associated command is
`b w`. - Stack size (not counting the value about to be pushed by
`m g`). This is zero if`m g`is executed with an empty stack. - Number radix. Default is 10; command is
`d r`. - Floating-point format. This is the number of digits, plus the
constant 0 for normal notation, 10000 for scientific notation,
20000 for engineering notation, or 30000 for fixed-point notation.
These codes are acceptable as prefix arguments to the
`d n`command, but note that this may lose information: For example,`d s`and`C-u 12 d s`have similar (but not quite identical) effects if the current precision is 12, but they both produce a code of 10012, which will be treated by`d n`as`C-u 12 d s`. If the precision then changes, the float format will still be frozen at 12 significant figures. - Angular mode. Default is 1 (degrees). Other values are 2 (radians)
and 3 (HMS). The
`m d`command accepts these prefixes. - Symbolic mode. Value is 0 or 1; default is 0. Command is
`m s`. - Fraction mode. Value is 0 or 1; default is 0. Command is
`m f`. - Polar mode. Value is 0 (rectangular) or 1 (polar); default is 0.
Command is
`m p`. - Matrix/Scalar mode. Default value is
*-1*. Value is 0 for Scalar mode,*-2*for Matrix mode,*-3*for square Matrix mode, or`N`for`N`x`N`Matrix mode. Command is`m v`. - Simplification mode. Default is 1. Value is
*-1*for off (`m O`), 0 for`m N`, 2 for`m B`, 3 for`m A`, 4 for`m E`, or 5 for`m U`. The`m D`command accepts these prefixes. - Infinite mode. Default is
*-1*(off). Value is 1 if the mode is on, or 0 if the mode is on with positive zeros. Command is`m i`.

For example, the sequence `M-1 m g RET 2 + ~ p` increases the
precision by two, leaving a copy of the old precision on the stack.
Later, `~ p` will restore the original precision using that
stack value. (This sequence might be especially useful inside a
keyboard macro.)

As another example, `M-3 m g 1 - ~ DEL` deletes all but the
oldest (bottommost) stack entry.

Yet another example: The HP-48 “round” command rounds a number
to the current displayed precision. You could roughly emulate this
in Calc with the sequence `M-5 m g 10000 % ~ c c`. (This
would not work for fixed-point mode, but it wouldn’t be hard to
do a full emulation with the help of the `Z [` and `Z ]`
programming commands. See Conditionals in Macros.)

Next: Calc Mode Line, Previous: Language Modes, Up: Mode Settings [Contents][Index]