[Openmcl-devel] Type-of and positive/negative integers

Daniel Kochmański daniel at turtleware.eu
Thu Oct 24 00:35:09 PDT 2019

>  CCL (1.11) has most-positive-fixnum of 1152921504606846975SBCL (1.5.6) has 4611686018427387903
> However:
> CL-USER> (subtypep 'fixnum 'integer)
> T
> T
> so FIXNUM is a subtype of INTEGER, and it should be the type returned if the implementation is following the CltL2 guidelines if I'm understanding the type system correctly.

CLtL2 has been superseded by ANSI specification so it is not
bounding. Anyway, more specific type here is

  (integer 0 #.most-positive-fixnum)

Try (subtypep (integer 0 #.most-positive-fixnum) 'fixnum) and it will
yield true as well.

The reason why you have result 'fixnum for negative and '(integer 0
#.most-positive-fixnum) for positive integers is probably because CCL
(and other implementations in fact) have a specialized representation
for unsinged fixnums (similar to i.e 'unsigned int' in C).


Daniel Kochmański ;; aka jackdaniel | Przemyśl, Poland
TurtleWare - Daniel Kochmański      | www.turtleware.eu

"Be the change that you wish to see in the world." - Mahatma Gandhi

More information about the Openmcl-devel mailing list