[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bignums are bogus



    Date: Thursday, 16 April 1987  02:01-EDT
    From: sandra%orion at cs.utah.edu (Sandra J Loosemore)
    To:   common-lisp at sail.stanford.edu
    Re:   bignums are bogus

    Three questions:

    (1) What is supposed to happen if the user attempts to create an integer 
    larger than the implementation can support?

A reasonable implementation would signal an error of some sort,
although if paging space is physically exhausted it may be difficult
for Lisp to recover gracefully.  Many OS'es don't provide any way to
user programs to tell how how much paging space is left, and tend to
wedge in various ways when it exhausted.

    (2) If "it is an error" to create a bignum larger than the implementation
    can handle, how can user programs detect and avoid this situation?

The problem with running out of storage has no special relation to
bignums of course.  Some programs may require data structures larger
than some implementations can support on a given hardware
configuration.  This is a potential portability problem, but I see
nothing that can be done about it.

    (3) Given that every implementation has some practical limit on
    the size of integers, but CLtL leaves that limit unspecified, is
    there any reason why an implementation couldn't choose to make
    that limit fairly small, like 32 or 64 bits or whatever the
    largest machine integer size is?  For that matter, what if the
    maximum size of an integer just happened to be the maximum size of
    a fixnum?

Your implementation might reasonably be considered to be unreasonable,
and not in the spirit of the specification.  As I said earlier, it is
quite possible to build an implementation that compiles with the
letter of a specification and is still totally unusable.

I'm not a big bignum user, but I think it might be marginally
reasonable to support fixed-size 64 bit bignums.  I suspect that 64
bit bignums would take care of a large percentage of uses.  This would
also keep get-universal-time happy for a while to come.

Perhaps Common Lisp should specify a minimum maximum size for bignums
and require that an error be signalled if this is ever exceeded.  I
would guess that a limit of a few thousand bits would meet every use
except the most common, namely impressing non-lispers by typing 
(FACT 1000) and getting screens full of digits.

  Rob