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

Finding largest integer



    Date: 1 May 1980 02:48-EDT
    From: Carl W. Hoffman <CWH at MIT-MC>

        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 ...

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

        Perhaps a (STATUS INFINITY)? A (STATUS WORDSIZE) would probably help...

    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.

Well, as much as I am sure that we will never try to transport to a non-2's
complement machine, I don't think it lends to code transparency to see this
sort of hackery. We are talking about precisely very machine dependent things.
Compilers may want to do things with word size. Constructs that return this
information for real with no strings attached are really called for and I 
don't think they are just sugar. They may not get used often but the places
where they do, you *really* want to be sure the right thing is happening.
-kmp