3.1.1 Numbers
Xcas works with both real and complex numbers. The real
numbers can be integers, rational numbers, floating point numbers or
symbolic constants.
You can enter an integer by simply typing the digits.
Alternatively, you can enter an integer in binary (base 2) by
prefixing the digits (0 through 1) with 0b, in octal (base 8)
by prefixing the digits (0 through 7) with 0 or 0o,
and in hexadecimal (base 16) by prefixing the digits (0 through 9 and
a through f) with 0x. (See Section 4.4.1.)
You can enter a rational number as the ratio of two integers.
The result will be put in lowest terms. If the top is a multiple of
the bottom, the result will be an integer.
A floating point number is regarded as an approximation to a real
number. You can enter a floating point number by writing it out with
a decimal point.
You can also enter a floating point number by
entering a sequence of digits, with an optional decimal point,
followed by e and then an integer, where the e
represents “times 10 to the following power.”
Floating point numbers with a large number of digits will be printed with
e notation; you can control how other floats are displayed
(see Section 2.5.7, item 2.5.7).
An integer or rational number can be converted to a floating point
number with evalf (see Section 6.3.1).
A complex number is a number of the form a+bi, where a
and b are real numbers. The numbers a and b will be the same
type of real number; one type will be converted to the other type if
necessary (an integer can be converted to a rational number or a
floating point number, and a rational number can be converted to a
floating point number).