The following rings are initially present in every session with Macaulay 2.
- ZZ -- the class of all integers
- QQ -- the class of all rational numbers
- RR -- the class of all real numbers
- CC -- the class of all complex numbers
The names of some of these rings are double letters so the corresponding symbols with single letters are preserved for use as variables.
Numbers in these rings are constructed as follows.
i1 : 1234
o1 = 1234
|
i2 : 123/4
123
o2 = ---
4
o2 : QQ
|
i3 : 123.4
o3 = 123.4
o3 : RR (of precision 53)
|
i4 : 123+4*ii
o4 = 123+4*ii
o4 : CC (of precision 53)
|
The usual arithmetic operations are available.
i5 : 4/5 + 2/3
22
o5 = --
15
o5 : QQ
|
i6 : 10^20
o6 = 100000000000000000000
|
i7 : 3*5*7
o7 = 105
|
i8 : 3.1^2.1
o8 = 10.7611716060997
o8 : RR (of precision 53)
|
i9 : sqrt 3.
o9 = 1.73205080756888
o9 : RR (of precision 53)
|
An additional pair of division operations that produce integer quotients and remainders is available.
i10 : 1234//100
o10 = 12
|
i11 : 1234%100
o11 = 34
|