Next Previous Contents

16. Customization

Several aspects of calc can be customized. These include, for example, the way to display numbers and the angle mode. There are two ways to set them: using the set command or using RPN commands (provided to make calc compatible with HP48 calculators.) The customizations that are not relevant in the HP48 (such as the prompt) can only be set with the command set.

16.1 The set command

The set command has the form:

> set [directive [option]]

If used without arguments, it will display all possible options. (Equivalent to help set.) If you give it a directive name, but no argument, it displays help about it (help set directive) followed by the current value (show directive.) And, if you give a directive and a value, some paramenter is changed.

To specify an option with a space, you must include the whole option between quotes, for example:

> set prompt "(calc) "

The show command is used to display the current value of an option. If used with no arguments, it displays all possible values (equivalent to help show.) If given an option name, it displays the current value of that option.

16.2 Options that can be set

Angle mode

The angle mode can be set to radians (the default) or degrees. To set it, use the set command this way:

> set anglemode {deg|rad}

The RPN equivalents are rad and deg. Both take no arguments, and return no values.

Coordinate mode

The coordinate system can be set to rectangular (the default) or polar. To set it, use the set command as follows:

> set anglemode {rect|polar|cylin}

Specifying rect selects rectanguar mode, and polar or cylin can be used to select polar mode.

You can also use the command rect and polar (or cylin) to select the coordinate mode.

Number display format and precision

These options are closely related. The number display format specifies how the numbers will be shown (the four available formats are described below), and the precision the number of decimal places to show in each mode. Note that precision does not really alter the precision of the calculator; all calculations are done using all possible precision numbers, but not all must be shown should you want it this way.

To set the number format, use the command

> set number-format {std|fix|sci|eng}

The available number formats are:

std

The ``standard'' mode is the common mode for displaying numbers: if possible, the number is not displayed in scientific notation, and decimal places are only shown if they are present. Up to 15 decimal places may be shown, but no trailing zeros are added.

fix

The ``fixed precision'' mode always display the number of decimal places specified by the precision option. Trailing zeros are added if necessary.

sci

The ``scientific notation'' mode always displays numbers using scientific notation, with the numberof decimal places specified by the precision option.

eng

The ``engineering notation'' mode displays precision + 1 significant digits using engineering notation. Engineering notation is like scientific notation, but the exponent is always a multiple of three.

To set the precision, use the set command as follows:

> set precision <n>

Where <n> is the number of decimal places you want. It must be between zero and fifteen, inclusive. Numbers less than zero are treated as zero, and numbers greater than fifteen are treated as fifteen. Only the integer part of the argument is considered.

Note that the precision is ignored for the std mode.

You can also set the precision with the commands std, fix, sci and eng. All but std take an argument in level one: the precision.

Prompt

The prompt can be set to anything you want, up to 10 characters long. To set it, use the set command this way:

> set prompt <prompt>

The only way to set the prompt is using the set command.

Number of lines to display

The number of stack lines to display can be set this way:

> set lines <x>

where <x> is the number of lines to display.

This option can be temporarily overridden by the = command. See The = command.

16.3 The configuration file

When you issue a quit or q command, all options are written to a configuration file, that is read again the next time you run calc. The location of this file varies: on MS-DOS systems, it is called calc.ini and is stored in the directory from where calc was run. On other systems, it is called .calc and is stored in the home directory (or, more precisely, the value of the HOME environment variable.)

This file is in binary form, and you should not try to alter it in any way.

The stack and memory are also saved in this file when you exit the calculator. The next time you run the calculator, the stack is restored, unless the -s or -m command line option (see Command Line Options) are set.

If you exit calc with the abort command, then it does not write its configuration file.


Next Previous Contents