Read-only forum archive

Long integers in Singular

Long integers in Singular

E-mail to Singular-Team · Thu Sep 22, 2005 6:05 pm

Hi.

Is there any way to define and use long integer numbers? Say 30 digits?

Long integers in Singular

lossen · Thu Sep 22, 2005 6:12 pm

Long integers are available as coefficients of polynomials. Define a ring:
Code:
> ring r=0,x,dp;

Then all objects of type number are arbitrary long integers resp. rationals:
Code:
> number n=12345678901234567890;
> number m=n^100;
> size(m);     // number of digits of m
204


For some applications also the use of "long floats" as polynomial coefficients could be appropriate:
Code:
> ring rr=(real,30),x,dp; // float with 30 digits
> rr;
//   characteristic : 0 (real:30 digits, additional 30 digits)
//   number of vars : 1
//        block   1 : ordering dp
//                  : names    x
//        block   2 : ordering C
> number n=12345678901234567890;
> n^100;
0.141741727427773144141199473044e+1910


Hope that answers your question.

Christoph Lossen
(Singular Team)