Hi, Doug,
There's been a discussion on the Maxima group about how to better integrate extended number types (like Maxima's bigfloats or intervals or bigfloat complex...) into the codebase.
Currently, Maxima objects are either atoms or their caar tells you their type. So you see code like this:
(cond ((atom ex)
(cond ((numberp ex) ...) ; handle machine numbers
...))
((eq (caar ex) 'bigfloat) ...) ; handle Maxima bigfloats
It was proposed that stashing bigfloats as a pointer in the NaN box of a float could make this simpler, but no one seems to have a concrete idea of how this would work with CL.
Would they be signalling NaNs which would dispatch to an extended arithmetic routine? Would this somehow be integrated with CLOS? etc.
That being said, it's not at all clear to me that this would simplify our code. For one thing, we would have to review all existing code for assumptions it makes (e.g., numberp implies realp, which isn't even true for CL numbers; trichotomy: not true for complexes and intervals) and tease out the exception cases. There are still parts of the Maxima code which don't accept bigfloats as numbers -- almost 50 years after bigfloats were added to the system!
So it would be interesting to know what has already been done with NaN boxing in CL in general and SBCL in particular.
-s