| ||||||||||||||||||||
Numbers
UltimaCalc's Algebra system works with four kinds of numbers: integers,
fractions, decimals, and complex numbers.
Integers
Integers, being 'whole' numbers, are be stored exactly, with no loss of precision. No arbitrary limit is imposed on the size of an integer, though they may be displayed in a truncated form. See Number output, below. The amount of memory allocated to the storage of an integer is proportional to the number of digits it has.
Fractions
Here, a fraction is a ratio of two integers where the denominator is greater than 1. Any factor common to both numerator and denominator will be removed. Because they are based on integers, fractions are stored exactly.
Decimals
All decimals occupy the same amount of memory for their storage, regardless of their value. This means that they are limited in precision to what the calculation engine used by UltimaCalc's main window is capable of, namely 128 bits or about 38 digits. More information
Complex numbers
A complex number is composed of two numbers, each of which can be an integer, a fraction, or a decimal.
You can use the Options window to specify whether to use decimals instead of fractions. You can also specify whether to use complex numbers, and if so, whether to use
i or j to represent the square root of minus one.
Number Input
There is no set limit to the number of digits that can be entered. Numbers containing decimal points
will be converted to integers if possible, or otherwise to either fractions or decimals, depending on the options setting. The exponent
markers e and E are recognised.
Examples:
1.2 + 3.4 gives the result 23/5 when decimal numbers are not selected.
1.234e5 is interpreted as the integer 123400 regardless of whether decimal numbers are selected.
12.4e-2 is interpreted as 0.124 if decimal numbers are selected, and as 31/250 if not.
Decimal points and exponent markers are always recognised. When decimals are not selected, the resulting number will always be either an integer or a fraction, and will therefore have an internal representation that is exact, with no loss of precision.
Number Output
In order to help make very long integers more readable, if a number ends in more than five consecutive zeroes, it will be displayed with an exponent marker. The number after the exponent marker indicates how many trailing zeroes have been hidden.
Examples:
The number 100000 is shown as 100000, the number 1000000
is shown as 1e6, and 1200000 is shown as 1200000.
The same applies to the numerator and denominator of a fraction. Decimals are shown to the precision used for UltimaCalc's main window.
Examples:
When using fractions, 2/9-0.22222222 gives the result 1/45e7
When using decimals, the result of 2/9-0.22222222 might be
displayed as 2.2222222 e-9 or, at maximum display precision, as
2.2222222222222222222222222222216135 e-9. The latter case shows
the loss of precision when using decimals.
See decimal below.
Large integers
In order to keep the display of large numbers manageable, you can specify the maximum number of digits to be shown. Numbers that have too many digits will be shown in an abbreviated form. For example, the value of 5000! may be shown as "about 4.228577926606e16325".
Conversion to Decimal
decimal(expr)
This function decimal creates a copy of an expression, replacing all fractions with decimals. This allows the use of fractions instead of decimals for internal calculations, converting the result to decimals at the end.
evaluate(expr)
The function evaluate simplifies its argument as much as possible, then passes the result to UltimaCalc's calculation engine for further evaluation. The result is returned as a decimal number. See decimal and evaluate.
Example:
When using fractions, the result of decimal(2/9-0.22222222)
when displayed at full precision, is 2.22222222222222222222222222222222222 e-9.
Here there is no loss of precision. The use of fractions means that no digits
were lost in the subtraction.
