`e`

(or `E`

).
The numbers and
should be entered like:

>> 5364 ans = 5364 >> -1.723478265342e12 ans = -1.7235E12Most of the time these will be stored as floating point data (double, IEEE standard 754). They are rounded to 5 significant digits for display, but for calculations the full precision of this format is always preserved (15-16 decimal digits). By switching the format (

`format long`

) all significant places are displayed.
>> format long >> -1.723478265342e12 ans = -1.723478265342E12As an extension Jasymca offers the command

`format Base Number`

,
which is used to display numbers in a system with arbitrary `Base`

with any `Number`

of significant digits. To
display numbers with digits in the binary system we type:
>> format 2 15 >> -1.723478265342e12 ans = -1.1001000101001E40Using

`format short`

returns the display mode to default (short
decimal). It should be emphasized, that none of the format commands influences
the
Numbers, which are entered without decimal point and exponent, and which are
larger than are stored as exact rational datatype. These numbers are internally
represented as quotient of two variable length integers (java datatype `BigInteger`

),
which allows you to perform calculations without any rounding errors. In the
first case of the following example a floating point number is generated,
in the second case an exact rational:

>> 10000000000000001. ans = 1.0E16 >> 10000000000000001 ans = 10000000000000001Each floating point number

`Z`

can be converted to an exact number
using the command `rat(Z)`

. The conversion is accomplished by continued fraction
expansion with an accuracy determined by the variable `ratepsilon`

(default: ).
>> rat(0.33333333333333333) ans = 1/3Operations between exact and floating point numbers always lead to the promotion of floating point numbers. Calculations can be performed without rounding errors by ``rationalizing'' just the first number.

>> 1/21/525/21/5*7*175*63*15-1 ans = -4.4409E-16 >> rat(1)/21/525/21/5*7*175*63*15-1 ans = 0Conversely, the command

`float(Z)`

converts numbers into floating point format.
Both commands also work for composite datatypes, like polynomials and matrices,
whose coefficients are transformed in one step. Irrational function values of
exact numbers and constants like `pi`

remain unevaluated until
the `float`

-command is issued.
>> sqrt(2) ans = 1.4142 >> sqrt(rat(2)) ans = sqrt(2) >> float(ans) ans = 1.4142

The exact datatype is useful especially for unstable problems, like solving systems of linear equations with ill-conditioned matrix. The Hilbert-matrix is an extreme example:

>> det( hilb(20)*invhilb(20) ) ans = 1 % correct >> det( float(hilb(20))*float(invhilb(20)) ) ans = 1.6713E151 % slightly wrong

Imaginary numbers are marked with an immediately following `i`

or `j`

.
This will work even if the predefined variables `i`

and `j`

have been overwritten.

>> 2+3i ans = 2+3i

2009-03-15