# basic rings of numbers

The following rings are initially present in every session with Macaulay2.
• 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 : 1.234e-20 o4 = 1.234e-20 o4 : RR (of precision 53) i5 : 123+4*ii o5 = 123+4*ii o5 : CC (of precision 53)
Integers may be entered in bases 2, 8, or 16 using particular prefixes.
 i6 : 0b10011010010 -- binary o6 = 1234 i7 : 0o2322 -- octal o7 = 1234 i8 : 0x4d2 -- hexadecimal o8 = 1234
The usual arithmetic operations are available.
 i9 : 4/5 + 2/3 22 o9 = -- 15 o9 : QQ i10 : 10^20 o10 = 100000000000000000000 i11 : 3*5*7 o11 = 105 i12 : 3.1^2.1 o12 = 10.7611716060997 o12 : RR (of precision 53) i13 : sqrt 3. o13 = 1.73205080756888 o13 : RR (of precision 53)
An additional pair of division operations that produce integer quotients and remainders is available.
 i14 : 1234//100 o14 = 12 i15 : 1234%100 o15 = 34
Numbers can be promoted to larger rings as follows, see RingElement _ Ring.
 i16 : 1_QQ o16 = 1 o16 : QQ i17 : (2/3)_CC o17 = .666666666666667 o17 : CC (of precision 53)
One way to enter real and complex numbers with more precision is to insert the desired number of bits of precision after the letter p at the end of the number, but before the possible e that indicates the exponent of 10.
 i18 : 1p300 o18 = 1 o18 : RR (of precision 300) i19 : 1p300e-30 o19 = 1e-30 o19 : RR (of precision 300)
Numbers can be lifted to smaller rings as follows, see lift.
 i20 : x = 2/3*ii/ii o20 = .666666666666667 o20 : CC (of precision 53) i21 : lift(x,RR) o21 = .666666666666667 o21 : RR (of precision 53) i22 : lift(x,QQ) 2 o22 = - 3 o22 : QQ