### 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.

1234321

1234321 |  |  |  |  |  |  |  |  |  |

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 5.4.1.)

0 xab12

43794 |  |  |  |  |  |  |  |  |  |

You can enter a rational number as the ratio of two integers.

123/45

41
15

The result will be put in lowest terms. If the top is a multiple of the bottom, the result will be an integer.

123/3

41 |  |  |  |  |  |  |  |  |  |

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.

123.45

123.45 |  |  |  |  |  |  |  |  |  |

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.”

1234 e3

1234000.0 |  |  |  |  |  |  |  |  |  |

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 7.3.1).

A complex number is a number of the form a+b i, 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).

3+1.1 i

3+1.1 i |  |  |  |  |  |  |  |  |  |