Integers and rational numbers
In Macaulay2, integers and rational numbers have any number of digits (up to memory limits at least).
i1 : 21672378126371263123123
o1 = 21672378126371263123123
|
i2 : 3748568762746238746278/5876584978947
1249522920915412915426
o2 = ----------------------
1958861659649
o2 : QQ
|
Integers are elements of the ring
ZZ of integers, and rational numbers are elements of the ring
QQ of rational numbers.
One point to notice is that there are two kinds of division,
/ and
//. The first returns a rational number (element of
QQ), while the second does division in
ZZ.
i3 : 6/3
o3 = 2
o3 : QQ
|
i4 : 7//3
o4 = 2
|
Real and complex numbers
Real and complex numbers are approximate numbers, implemented using the
MPFR library.
i5 : 1.372489274987
o5 = 1.372489274987
o5 : RR (of precision 53)
|
i6 : 1.3454353 * 10^20
o6 = 1.3454353e20
o6 : RR (of precision 53)
|
i7 : sqrt 4.5
o7 = 2.121320343559642
o7 : RR (of precision 53)
|
i8 : toRR_200 4.5
o8 = 4.5
o8 : RR (of precision 200)
|
i9 : sqrt oo
o9 = 2.12132034355964257320253308631454711785450781306542210976502
o9 : RR (of precision 200)
|
i10 : 1/(1+ii)
o10 = .5-.5*ii
o10 : CC (of precision 53)
|