Singular
https://www.singular.uni-kl.de/forum/

Long integers in Singular
https://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=1458
Page 1 of 1

Author:  E-mail to Singular-Team [ Thu Sep 22, 2005 6:05 pm ]
Post subject:  Long integers in Singular

Hi.

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

Author:  lossen [ Thu Sep 22, 2005 6:12 pm ]
Post subject: 

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)

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/