**Table of Contents**

Qalculate! provides flexible parsing, calculation output and result display. There are several ways in which parsing of expression and display of results can be customized. These modes can generally be changed through the mode menu. The state of each mode can be saved under a name in

→ for quick access. The Preset and Default meta modes are always available and represents the state when Qalculate! is load for the first time and the mode settings automatically loaded at each startup (and by default saved on exit), respectively. Different modes are summarized below.- Number Bases
Non-decimal bases can be selected for display of numbers in the result. This include regular number bases (binary, octal, hexadecimal, sexagesimal) as well as sexagesimal time format and roman numerals. All number bases between 2 and 36, and base for expression input, can be selected from a dialog window accessed from the section called “Convert Number Bases Dialog”) is efficient for simple conversion between common bases.

→ → or → → . The convert number bases dialog (see- Numerical Display
These modes mainly control when numbers are displayed exponentially (ex. “2.62E3” which equals “2620”). In the default normal mode, numbers are displayed in exponential format if the exponent will be greater than the current precision. In scientific mode the lowest exponent is 3. In simple numerical mode the exponential format is never used and it is always used in purely scientific mode. In the engineering mode, the exponent is always a multiple of three. This is naturally equivalently true for numbers less than one and negative exponents. When the scientific modes are selected in the keypad (not from the menubar), negative exponents are automatically activated and sort minus last deactivated, while normal and simple modes do the opposite.

- Indicate Infinite Series
If this option is on, Qalculate! will not round infinitely repeating digit sequences if discovered. Instead “...” will be displayed after the maximal number of decimals and the result indicated as exact (compare “2/3 = 0.666667” with “2/3 = 0.666666...”).

- Round Halfway Number To Even
With this option, halfway numbers will be rounded to even instead of upwards (ex. 2.65 is then rounded to 2.6 instead of 2.7). Note that this behavior is always applied in the

**round()**function.- Show Ending Zeroes
if this option is on, approximate numbers in the result will be appended with zeroes, so that the number of digits (after preceding zeroes) will equal the precision.

- Negative Exponents
If negative exponents is activated, division is shown as a negative power (ex. “x * y^-1” instead of “x / y”).

- Sort Minus Last
This option decides if minus signs should be avoided in the first positions of the result expression.

- Fractional Display
This controls if numbers are displayed in fractional or decimal mode. Decimal mode displays numbers as usually expected (“6/4 = 1.5”), combined displays a whole number and a fraction (“6/4 = 1 1/2”) and fractional only displays as fraction (“6/4 = 3/2”).

- Unit Display
The automatic use of prefixes for units in results can be toggled on and off. By default prefixes are only used for a selection of units (mainly standard SI and CGS units), but this can be changed to also include currencies or all other units. By default prefixes representing a power of ten not dividable by three (centi, deci, deca and hekto) are not used and need to be enabled. If denominator prefixes are not explicitly enabled, prefixes will only be set for the numerator in a fractional unit expression (ex. “1 Mg/m” or “1 kg/mm”), unless there is no unit in the numerator. The place units separately alternative controls the display of unit expressions in result. If it is enabled (default) units will be displayed separate from other parts of the expression at the end (compare “(5x*m)/(y*s)” and “5x/y m/s”).

- Abbreviate Names
The display of unit, prefix, variable and function names can be controlled by selecting to display abbreviations or full length names (ex. “5 cm” or “5 centimeters”). Both abbreviations and long names can however always be entered in expressions.

- Approximation
When always exact mode is on, the calculation will not go further than what can be calculated exactly (ex. “sqrt(2+3) = sqrt(5)”). The default “Try Exact” mode, will calculate the result exact as far as possible and then approximately. Approximate mode will directly calculate a approximate result, thus being a bit faster but giving a less correct approximate indication (“sin(pi/2)” return approximately one instead of exactly one).

- Assumptions
This controls the default assumptions for unknown variables without explicitly defined assumptions. See Chapter 5,

*Variables*. The assume denominators non-zero alternative makes it possible to avoid the situation where expressions such as “(x-1)/(x-1)” can not be further simplified because the denominator might be zero (if x equals 1). With this alternative activated the example can be reduced to 1.- Parsing Mode
These options controls how expressions are interpreted. There are three main modes, which mainly controls if implicit multiplication is handled differently from explicit multiplication and if spaces are taken into account or not. See the section called “Implicit Multiplication and Parsing Modes”. If the read precsion option is activated, decimal numbers are intrepeted as approximate with precision equal to the number of digits (ex. “1.1 * 1.1 ≈ 1.2”).

- Precision
Precision controls the precision in approximate numbers and the number of significant digits. If the read precision option is turned on, input numbers with decimals will be interpreted as approximate with a precision equal to the number of digits (ex. “2.50 + 3.4567 = 5.96”).

- Decimals
In the decimals dialog, the number of decimals displayed can be controlled. This includes minimal (will fill out with zeroes) and maximal number of decimals (will round numbers).

The Reverse Polish Notation mode can be activated from **Ctrl**+**R** or from the context menu of the expression entry. For details about what Reverse Polish Notation is and how it generally works, see for example the RPN article at Wikipedia.

Central to the RPN mode is the stack, a list of registers/values that is operated on by functions and operators. The stack has a variable number of registers which can hold an unlimited number of values. The stack size is dynamically changed when a new value is added and the first value on the stack is shown in the result display. Mathematical operators such as plus and minus then operates on the first two, last added, values on the stack. The second value is changed with input from the first value. For example, the minus operator subtracts the first value from the second. Functions which require exactly one argument operates on the first value on the stack. Other functions, which require multiple arguments, must be entered in normal expression based way.

When the RPN stack is enabled full expression can still be entered (you can add e.g. “5x+3+23+sin(2)” directly to the stack). The buttons on the keypad do not insert operators and functions in the expression entry, but instead applies them to the stack. This is also true for the keypad keys on the keyboard. **Enter** calculates the current expressions and adds it to the stack (calculated mathematical expressions are automatically added to the stack when the RPN stack is enabled). If the expression entry is not empty when applying an operator or function to the stack, the expression is first calculated and added to the stack. All keys on the main part of the keyboard add the corresponding characters in the expression entry, unless the Use only keypad keys for RPN option is deactivated from the preferences dialog. To apply the raise operator '^' to the stack, without clicking the keypad button with the mouse, use the **Ctrl**+*** (keypad)** shortcut. If the expression only contains an operator or a function, which requires exactly one argument, the operator/function is applied to the stack.

For example, **5 ENTER 3 + 2 /** adds 5 to the stack, then adds 3 to the stack and moves 5 down a step and adds 3 to 5. The first value, 3, is removed from the stack and the value left is 8. Then 2 is added to the stack and 8 is divided by 2, resulting in 4. This would in a single expression with non-RPN (infix) syntax be entered as “(5+3)/2”.

Reverse Polish Notation can also be used directly in expression. This can be activated or deactivated separately from the RPN stack (both RPN syntax and the stack are activated when using the keyboard shortcut). When using RPN syntax, a temporary stack, separate from the previously mentioned stack, is created from the contents of each mathematical expression entered. To calculate “(5+3)/2”, as in the example above, with RPN syntax you should enter the expression “5 3 + 2 /”. Instead of actually pressing enter on the keyboard, each separate value on the stack is separated by a blank space.

The RPN mode adds a third page to the main window, for display and manipulation of the values on the stack. This shows a list of values on the stack, with the last added value on the top. On the right are buttons for manipulation of the stack. The buttons move the selected value up or down, move it to the top, edit it, or removes it, in order. If no stack row is selected, the up and down buttons rotates the stack, the swap button swaps the places of the first and second value and the copy and delete buttons acts on the the top value of the stack. The last button removes all values from the stack. On the left are buttons for applying mathematical operations to the stack. These works the same as buttons on the separate keypad.

Changes in the display of results only affects the first value on the stack.