Let's not get too carried away. We were talking about a system for Maxima, which
is a symbolic algebra system. These symbolic algebra systems typically want _exact_
answers, not numerical approximations, so I'm not fond of cluttering up such a system
(especially when it doesn't even yet exist!) with a multiplicity of floating point
formats and results.
There will be plenty of time for that later, once the basic "exact" system is in
place and there is some experience with it.
"Premature optimization" has some disadvantages in common with other premature problems.
Your example re the cmucl or sbcl compilers proves that -- for now -- Maxima isn't as
smart as some Common Lisp compilers. This deficit is why I issued my proposal re
the incorporation of ordered unions of disjoint atomic intervals into Maxima.
At 04:28 PM 2/4/2013, David Stoutemyer wrote:
>Yes that is an example of what I mean..
>
>I hate it when information is unavoidably lost -- particularly when there is no compensating benefit such as "much simpler but less tight" result.
>
>Thanks, david stoutemyer
>
>On Mon, Feb 4, 2013 at 2:07 PM, Raymond Toy <toy.raymond at gmail.com> wrote:
>>>>>> "David" == David Stoutemyer <dstout at hawaii.edu> writes:
>
> David> I would also like to see the infectiousness of Floats and
> David> Big Floats be on a local basis of each real arithmetic
> David> operation rather than degrading all numbers in a
> David> multi-interval whenever one of them is a Float or a Big
> David> Float.
>
>Do you mean that if x and y are both unions of the intervals [1,5] and
>[8.0, 9.0], then you want x*y to be the union of [1, 25], [8.0, 45.0],
>and [64.0, 81.0]?
>
>Ray
>
>P.S. If you have cmucl or sbcl, you can try
>
>(defun foo (x y)
> (declare (type (or (integer 1 5) (single-float 8.0 9.0)) x y))
> (* x y))
>(compile 'foo)
>(describe 'foo)
>[snip other output from foo]
>Its result type is:
> (OR (SINGLE-FLOAT 64.0 81.0) (SINGLE-FLOAT 8.0 45.0) (INTEGER 1 25))