Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
bignums in clisp
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  19 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
((( 1/f )))  
View profile  
 More options Sep 12 2012, 5:34 am
Newsgroups: comp.lang.lisp
From: "((( 1/f )))" <fade...@gmail.com>
Date: Wed, 12 Sep 2012 02:34:46 -0700 (PDT)
Local: Wed, Sep 12 2012 5:34 am
Subject: bignums in clisp
dear forum,

I'm very new to LISP but not to programming, and my main interest is experimental mathematics.

I wanted to know how big the numbers could be for calculation, and I was under the assumption that one could go anywhere as long as the computer didn't crash. It appears that the limit is:

2^2097089 - 1 and any command will overflow beyond that. I just calculated the
number of digits roughly in my version of clisp ( 2.48) running on a linux box:

>(length (write-to-string (- (expt 2 2097085) 1)))

 631286

Is there any way to increase this to a much higher, arbitrary limit?

-------------------------------------------------------
(((1/f)))


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Sep 12 2012, 5:48 am
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Wed, 12 Sep 2012 11:48:23 +0200
Local: Wed, Sep 12 2012 5:48 am
Subject: Re: bignums in clisp
"((( 1/f )))" <fade...@gmail.com> writes:

> dear forum,

> I'm very new to LISP but not to programming, and my main interest is experimental mathematics.

> I wanted to know how big the numbers could be for calculation, and I was under the assumption that one could go anywhere as long as the computer didn't crash. It appears that the limit is:

> 2^2097089 - 1 and any command will overflow beyond that. I just calculated the
> number of digits roughly in my version of clisp ( 2.48) running on a linux box:

>>(length (write-to-string (- (expt 2 2097085) 1)))
>  631286

> Is there any way to increase this to a much higher, arbitrary limit?

Obviously,  you can compute a number that's 1 bigger than the limit
you're saying: (expt 2 2097085).

But otherwise you're right, there's a limit.

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sam Steingold  
View profile  
 More options Sep 12 2012, 1:42 pm
Newsgroups: comp.lang.lisp
From: Sam Steingold <s...@gnu.org>
Date: Wed, 12 Sep 2012 13:42:25 -0400
Local: Wed, Sep 12 2012 1:42 pm
Subject: Re: bignums in clisp

> * ((( 1/f ))) <snqr...@tznvy.pbz> [2012-09-12 02:34:46 -0700]:

> I wanted to know how big the numbers could be for calculation, and I was
> under the assumption that one could go anywhere as long as the computer
> didn't crash. It appears that the limit is:

> 2^2097089 - 1 and any command will overflow beyond that. I just calculated the
> number of digits roughly in my version of clisp ( 2.48) running on a linux box:

the limits are documented here:
http://www.clisp.org/impnotes/num-concepts.html#num-const

>>(length (write-to-string (- (expt 2 2097085) 1)))
>  631286

> Is there any way to increase this to a much higher, arbitrary limit?

http://www.cygwin.com/acronyms/#PTC

--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://mideasttruth.com http://www.memritv.org
http://www.PetitionOnline.com/tap12009/ http://iris.org.il http://dhimmi.com
In every non-trivial program there is at least one bug.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Clifton  
View profile  
 More options Sep 28 2012, 11:45 am
Newsgroups: comp.lang.lisp
From: Ian Clifton <ian.clif...@chem.ox.ac.uk>
Date: Fri, 28 Sep 2012 16:45:57 +0100
Local: Fri, Sep 28 2012 11:45 am
Subject: Re: bignums in clisp

Sam Steingold <s...@gnu.org> writes:
>> * ((( 1/f ))) <snqr...@tznvy.pbz> [2012-09-12 02:34:46 -0700]:

>> I wanted to know how big the numbers could be for calculation, and I was
>> under the assumption that one could go anywhere as long as the computer
>> didn't crash. It appears that the limit is:

>> 2^2097089 - 1 and any command will overflow beyond that. I just
>> calculated the
>> number of digits roughly in my version of clisp ( 2.48) running on a
>> linux box:

> the limits are documented here:
> http://www.clisp.org/impnotes/num-concepts.html#num-const

Wow, I never realised that (in clisp) long-floats can represent even
bigger numbers than bignums.
--
Ian ◎

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Barry Margolin  
View profile  
 More options Sep 28 2012, 4:04 pm
Newsgroups: comp.lang.lisp
From: Barry Margolin <bar...@alum.mit.edu>
Date: Fri, 28 Sep 2012 16:04:01 -0400
Local: Fri, Sep 28 2012 4:04 pm
Subject: Re: bignums in clisp
In article <k44gnl$o3...@news.ox.ac.uk>,
 Ian Clifton <ian.clif...@chem.ox.ac.uk> wrote:

But not to with as much precision.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kaz Kylheku  
View profile  
 More options Sep 28 2012, 5:48 pm
Newsgroups: comp.lang.lisp
From: Kaz Kylheku <k...@kylheku.com>
Date: Fri, 28 Sep 2012 21:48:15 +0000 (UTC)
Local: Fri, Sep 28 2012 5:48 pm
Subject: Re: bignums in clisp
On 2012-09-28, Barry Margolin <bar...@alum.mit.edu> wrote:

They are not "bigger", just more, err, "magnitudinous"!

Bigger means, strictly, occupying more RAM. :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RG  
View profile  
 More options Sep 29 2012, 10:22 am
Newsgroups: comp.lang.lisp
From: RG <rNOSPA...@flownet.com>
Date: Sat, 29 Sep 2012 07:22:10 -0700
Local: Sat, Sep 29 2012 10:22 am
Subject: Re: bignums in clisp
In article <20120928140653....@kylheku.com>,
 Kaz Kylheku <k...@kylheku.com> wrote:

Anyone interested in big numbers should read this:

http://mrob.com/pub/math/largenum.html

http://mrob.com/pub/perl/hypercalc.html

rg


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Barry Margolin  
View profile  
 More options Sep 29 2012, 9:54 pm
Newsgroups: comp.lang.lisp
From: Barry Margolin <bar...@alum.mit.edu>
Date: Sat, 29 Sep 2012 21:54:49 -0400
Local: Sat, Sep 29 2012 9:54 pm
Subject: Re: bignums in clisp
In article <20120928140653....@kylheku.com>,
 Kaz Kylheku <k...@kylheku.com> wrote:

It obviously depends on the context. I'm pretty sure he meant it in the
normal, mathematical sense, in which 10 is bigger than 9.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nils M Holm  
View profile  
 More options Sep 30 2012, 2:24 am
Newsgroups: comp.lang.lisp
From: Nils M Holm <news2...@t3x.org>
Date: 30 Sep 2012 06:24:14 GMT
Local: Sun, Sep 30 2012 2:24 am
Subject: Re: bignums in clisp

RG <rNOSPA...@flownet.com> wrote:
> Anyone interested in big numbers should read this:

> http://mrob.com/pub/math/largenum.html

Definitely! This article changed my perspective on large numbers.

--
Nils M Holm  < n m h @ t 3 x . o r g >  www.t3x.org


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Clifton  
View profile  
 More options Oct 2 2012, 10:54 am
Newsgroups: comp.lang.lisp
From: Ian Clifton <ian.clif...@chem.ox.ac.uk>
Date: Tue, 02 Oct 2012 15:54:55 +0100
Local: Tues, Oct 2 2012 10:54 am
Subject: Re: bignums in clisp

Barry Margolin <bar...@alum.mit.edu> writes:
> In article <20120928140653....@kylheku.com>,
>  Kaz Kylheku <k...@kylheku.com> wrote:

>> They are not "bigger", just more, err, "magnitudinous"!

>> Bigger means, strictly, occupying more RAM. :)

> It obviously depends on the context. I'm pretty sure he meant it in the
> normal, mathematical sense, in which 10 is bigger than 9.

I suppose it would be possible—not perhaps sensible, but possible—to
have a Lisp implementation whose bignum type had a length which could
expand as necessary beyond integer to itself become a bignum of the same
kind. Such a Lisp could represent any integer, I guess.

--
Ian ◎


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Wallich  
View profile  
 More options Oct 2 2012, 11:17 am
Newsgroups: comp.lang.lisp
From: Paul Wallich <p...@panix.com>
Date: Tue, 02 Oct 2012 11:17:53 -0400
Local: Tues, Oct 2 2012 11:17 am
Subject: Re: bignums in clisp
On 10/2/12 10:54 AM, Ian Clifton wrote:

Aren't you going to run out of memory long before then? Perhaps there
should be bignums with some kind of sparse-byte or runlength encoding.

paul


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Oct 2 2012, 11:19 am
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Tue, 02 Oct 2012 17:19:18 +0200
Local: Tues, Oct 2 2012 11:19 am
Subject: Re: bignums in clisp

So you don't read the links given to you.  Interesting.

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Oct 2 2012, 11:21 am
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Tue, 02 Oct 2012 17:21:01 +0200
Local: Tues, Oct 2 2012 11:21 am
Subject: Re: bignums in clisp

Of course.  There are a finite number of integers whose lengths are
smaller than the number of particules in the Universe.  On the other
hand, there are an infinite number of integers whose lengths are bigger
than the number of particules in the Universe.  Such a trivial truth
doesn't seem to be known even by "educated" people.  I despair of
humanity.

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Clifton  
View profile  
 More options Oct 2 2012, 12:25 pm
Newsgroups: comp.lang.lisp
From: Ian Clifton <ian.clif...@chem.ox.ac.uk>
Date: Tue, 02 Oct 2012 17:25:00 +0100
Subject: Re: bignums in clisp
"Pascal J. Bourguignon" <p...@informatimago.com> writes:

I did briefly read and enjoy (some of) the links, and I did hint that my
suggestion wasn’t entirely sensible!
--
Ian ◎

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Wallich  
View profile  
 More options Oct 2 2012, 9:48 pm
Newsgroups: comp.lang.lisp
From: Paul Wallich <p...@panix.com>
Date: Tue, 02 Oct 2012 21:48:00 -0400
Subject: Re: bignums in clisp
On 10/2/12 11:21 AM, Pascal J. Bourguignon wrote:

I certainly despair of its sense of humor.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Clifton  
View profile  
 More options Oct 3 2012, 5:38 am
Newsgroups: comp.lang.lisp
From: Ian Clifton <ian.clif...@chem.ox.ac.uk>
Date: Wed, 03 Oct 2012 10:38:18 +0100
Local: Wed, Oct 3 2012 5:38 am
Subject: Re: bignums in clisp

Sorry! I just thought it was interesting that such a scheme could (I
think) be implemented (although you’d have to work out how to do
indexing of data structures by bignum etc), even though we all know it
couldn’t possibly work in any useful sense. I recall that Bart Simpson
once lined up several police bull‐horns, the output of one feeding into
the microphone of the next, in order to produce a stupendously loud
sound. Of course this wouldn’t work either, but you could attempt the
experiment.

--
Ian ◎


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Oct 3 2012, 7:27 am
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Wed, 03 Oct 2012 13:27:21 +0200
Local: Wed, Oct 3 2012 7:27 am
Subject: Re: bignums in clisp

Ian Clifton <ian.clif...@chem.ox.ac.uk> writes:
> Sorry! I just thought it was interesting that such a scheme could (I
> think) be implemented (although you’d have to work out how to do
> indexing of data structures by bignum etc), even though we all know it
> couldn’t possibly work in any useful sense. I recall that Bart Simpson
> once lined up several police bull‐horns, the output of one feeding into
> the microphone of the next, in order to produce a stupendously loud
> sound. Of course this wouldn’t work either, but you could attempt the
> experiment.

Well we're speaking of lisp here, so there's a solution.  It's easy to
represent a number bigger than the universe in lisp: just use a sexp!

    (↑↑↑↑  3  3)

    (↑27↑   3  3)

    (lessp  '(↑27↑   3  3) (add '(↑27↑   3  3) '(↑↑↑↑  3  3)))

(defun ↑      (x y) (expt x y))
(defun ↑↑    (x y) (expt x (expt y y)))
(defun ↑↑↑  (x y) (expt x (expt y (expt y y))))
(defun ↑↑↑↑ (x y) (expt x (expt y (expt y (expt y y)))))

(↑↑ 3 3) --> 7625597484987

(↑↑↑ 3 3) can't be computed on current hardware, but you can still
represent this number, as the sexp (↑↑↑ 3 3), like you can represent 100
as: (* (expt 5 2) (expt 2 2)) or some other sexp.

And you can write functions like add and lessp that compute
symbolically. (You can use a theorem prover to implement them).

(defun add (a b)
 (cond
  ((and (numberp a) (numberp b))
   (+ a b))
  ((and (numberp a) (zerop a)) b)
  ((and (numberp b) (zerop b)) a)
  (t `(+ ,a ,b))))

(add '(↑27↑   3  3) '(↑↑↑↑  3  3))
--> (+ (↑27↑ 3 3) (↑↑↑↑ 3 3))

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nils M Holm  
View profile  
 More options Oct 3 2012, 8:24 am
Newsgroups: comp.lang.lisp
From: Nils M Holm <news2...@t3x.org>
Date: 3 Oct 2012 12:24:00 GMT
Subject: Re: bignums in clisp
Pascal J. Bourguignon <p...@informatimago.com> wrote:

> (defun ?      (x y) (expt x y))
> (defun ??    (x y) (expt x (expt y y)))
> (defun ???  (x y) (expt x (expt y (expt y y))))
> (defun ???? (x y) (expt x (expt y (expt y (expt y y)))))

If you get tired of inventing ????'s (sorry, only ASCII here), notice
that the operator can be generalized for more then 4 ?'s as:

(f (- n 1) x (f n x (- y 1)))

where F is the function implementing the operators and N is the order
of the operator (number of ?'s). See also: hyper operator.

Here's an implementation in Scheme: http://t3x.org/s9fes/hyper.scm.html

--
Nils M Holm  < n m h @ t 3 x . o r g >  www.t3x.org


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Don Geddis  
View profile  
 More options Oct 8 2012, 7:17 pm
Newsgroups: comp.lang.lisp
From: Don Geddis <d...@geddis.org>
Date: Mon, 08 Oct 2012 16:17:32 -0700
Local: Mon, Oct 8 2012 7:17 pm
Subject: Re: bignums in clisp
"Pascal J. Bourguignon" <p...@informatimago.com> wrote on Wed, 03 Oct 2012:

> Well we're speaking of lisp here, so there's a solution.  It's easy to
> represent a number bigger than the universe in lisp: just use a sexp!

It seems like you're heading down the path of using textual character
representations, to describe big numbers.  Surely, before too long,
you'll just follow the standard sequence of such inventions, and wind up
at the usual
        busy-beaver(99)
which likely beats any other number you could describe with a similar
small number of characters.

But presumably, people are looking for a representation of a large
integer N, such that the representation is capable of referring to any
of the integers from 1..N.

It kind of changes the problem, if you're just trying to describe (a
few, special) very big numbers in a small number of characters.

        -- Don
___________________________________________________________________________ ____
Don Geddis                  http://don.geddis.org/               d...@geddis.org
You might be an economist if you refuse to sell your children because they
might be worth more later.  -- Yoram Bauman


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »