up previous next
4.2.1 Introduction to Numbers
|
There are three types of numbers recognized by CoCoA: integers (type
INT), rationals (type
RAT), and modular integers (type
ZMOD). Numbers
in CoCoA are handled with arbitrary precision. This means that the
sizes of numbers are only limited by the amount of available memory.
The basic numeric operations---addition (
+), subtraction (
-),
multiplication (
*), division (
/), exponentiation (
^), and negation
(
-)---behave as one would expect. Be careful, two adjacent minus
signs,
--, start a comment in CoCoA.
N := 3;
-N;
-3
-------------------------------
--N;
|
The last line in the above example does not return 3; it is
interpreted as a comment.