detecting lisp overflow



I'm not sure who consumes the output of adaptive-plot, so I don't know what
the best representation of "a number too large to represent" is.  I guess
that an IEEE Inf value is problematic because not all Lisps support it.

             -s

On Mon, Mar 18, 2013 at 6:34 PM, Edwin Woollett <woollett at charter.net>wrote:

> On Mar. 18, 2013, Stavros Macrakis wrote:
> ------------------------------**--------
>
>  Try the following test instead:
>>
>> :lisp (float-inf-p (elt (list 100.0 (exp 1000.0)) 1))
>>
>> In some Lisp implementations, exp(1000) will give an error, but if it
>> doesn't, and gives an INF, this should work.
>>
> ------------------------------**-------------
> This works, but if I follow your drift, you seem to be
> suggesting that I rewrite adaptive-plot to return a more
> informative output list, using, say, some mutation of
>
> (if (float-inf-p (fun x))
>    (cons x (cons 'INF mylist))
>    (cons x (cons (fun x) mylist)))
>
> In gcl, I get the behavior:
>
> (%i2) :lisp (float-inf-p (elt (list 100.0 (exp 1000.0)) 1))
> T
>
> (%i2) :lisp (float-inf-p (exp 1000.0))
> T
>
> Ted
>
>
>
>