[Openmcl-devel] Type-of and positive/negative integers
Daniel Kochmański
daniel at turtleware.eu
Wed Oct 23 23:55:35 PDT 2019
Hey Steven,
What is the most-positive-fixnum on your implementation? I would suspect
that it is 1152921504606846975, so (INTEGER 0 1152921504606846975) is a
subtype of FIXNUM, hence it is more specific type.
Best regards,
Daniel
Steven Nunez writes:
> I've been stumped by trying to understand why:
> ? (type-of -3)
> FIXNUM
> ? (type-of 3)
> (INTEGER 0 1152921504606846975)
> ?
> return different types. I know that type-of is somewhat ill-defined, but in my reading of the spec, '3' should also be a fixnum, since it is between most-negative-fixnum and most-positive-fixnum. CLtL2 suggests that implementors return the most specific type, and that would also be fixnum. Steele later points out some flaws in the current specification of type-of. Both CCL and SBCL exhibit this behaviour.
> Two questions for the smart ones out there:
>
> - Is there something in the spec that I missed that makes type-of behave this way?
> - Is there a way to do a type checking assertion for fixnums that works with both positive and negative integers? I am trying to optimize some numerical functions.
>
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> https://lists.clozure.com/mailman/listinfo/openmcl-devel
--
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