Mark Stickel wrote: [1999-07-20 21:20 -0700]
(to the ·····@ai.sri.com list)
Among other items:
> 5. Mandate bigger FIXNUMs
>
> The current standard requires fixnums at least include integers in the
> range [-2^15-1,2^15]. Common Lisp implementation often provide much
> larger fixnums (e.g., Allegro, Liquid, CMU, and Macintosh Common Lisp
> all provide [-2^29-1,2^29] fixnums), but Common Lisp programs cannot
> portably declare fixnum variables unless values are in [-2^15-1,2^15].
> It would be beneficial to increase the official minimum range of
> fixnums so that fixnum declarations can be more widely used to specify
> efficient arithmetic. I propose that the fixnum range for standard
> compliant Common Lisp be set assuming that 32 bit integer arithmetic
> is efficient and that a fixnum is contained in a field of at least 32
> bits including tag bits; I think these are realistic assumptions for
> today's processors and Common Lisp implementations. I suggest that
> fixnums at least include [-2^23-1,2^23] (allowing a 24 bit signed
> integer and 8 tag bits in a 32 bit field). Still larger ranges, such
> as [-2^29-1,2^29], might be argued for if they are already a de facto
> standard.
Is this really necessary?
If I want a specific range, e.g. [-2^23-1,2^23], I can use
(INTEGER #.(- 0 (EXPT 2 23) 1) #.(EXPT 2 23)) and I would rely
on the implementation to notice that this is within the FIXNUM
range.
It appears as an unnecessary burden on implementors to ensure
a larger fixnum range. Moreover, using FIXNUM in production
code (as opposed to just trying things out) is sort of quick and
dirty; one should always use (INTEGER low high) and let the
compiler see for itself that this fits in a fixnum. (Yes, I know
that there are implementation who don't do it but, well...)
Vassil Nikolov
Permanent forwarding e-mail: ········@poboxes.com
For more: http://www.poboxes.com/vnikolov
Abaci lignei --- programmatici ferrei.