detecting lisp overflow



On 3/16/2013 2:36 PM, Edwin Woollett wrote:
> If I call adaptive-plot (plot.lisp) appropriately with a function like 
> exp(x^3) to see what overflow
> causes adaptive-plot to return, I get, for example,
> the lisp list
>
> (100.0 #<1.#INF00e+000> 100.24245689655172 #<1.#INF00e+000>
>           100.48491379310344 #<1.#INF00e+000> 100.72737068965517
>           #<1.#INF00e+000> 100.96982758620689 #<1.#INF00e+000> .....  )
>
> I want to detect that this result is not a list of floating point 
> numbers.
>
> If I use either:
>
>       (numberp  #<1.#INF00e+000> )
>
> or
>
>      ($numberp  #<1.#INF00e+000> )
>
> I get a lisp error.
>
> Is there some other way to detect this type of output?
>
> Ted Woollett
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
The support for IEEE754 arithmetic in Common Lisp is not standardized.
you can do ..
:lisp (setf $big most-positive-double-float $bigger (exp 1000.0d0))

to get 2 numbers that might be of some use "generally" in comparison.

There are probably in each lisp a way of testing for a number being
infinity as part of some "system" package.  Just not the same.

Here's a start..


(defmacro inf-p(x)
   #+allegro     `(excl::infinityp ,x)
   #+SBCL        `(sb-vm::float-infinity-p ,x)
   #+gcl          `(float-inf-p ,x))