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

Finding largest integer

    Date: 30 April 1980 1812-EDT
    From: Dave Touretzky at CMU-10A

    Is there any variable or status call in MacLisp that gives the maximum
    integer (excluding bignums) and minimum integer representable on the
    machine?  I know the answer, I just want to know if I can get MacLisp
    to tell me.

    Date: 30 APR 1980 1830-EDT
    From: KMP at MIT-MC (Kent M. Pitman)

    My FORTRAN stuff would love to know this, too. Perhaps a (STATUS INFINITY)?
    A (STATUS WORDSIZE) would probably help, but for languages like NIL that
    won't use all the bits for representing the number, both are really needed.

Assuming that two's complement arithmetic is being used, (ROT 1 -1) will
give you the smallest fixnum, and (LSH -1 -1) will give you the largest
fixnum.  (HAULONG (ROT 1 -1)) will give you the number of bits in a fixnum.
Outside of code that is a part of the Lisp system, there should be no need
to know the actual wordsize of the machine.  Bit vectors are available in
both LMLisp and NIL.