detecting lisp overflow



Ted,

As has been mentioned before, you can't enter IEEE infinity with the syntax
#<1.#inf00e+000>. In general, #... means something that the Lisp reader
cannot read back in.  That said, I'd have thought that there should be a
readable representation of Inf, Nan, etc.

The default dispatch macro in question is presumably the read macro for #
(yes, the error message could be clearer).

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.

      -s

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

>
> On Mar. 17, 2013, Raymond Toy wrote
>
>  You don't have to convert to strings, which would be a pretty bad
>> approach.  Let RESULT be the list that is printed above.  Then you can
>> do
>>
>> (float-inf-p (elt result 1))
>>
>> That should give T since the second element of result is
>> #<1.#inf00e+000>, which, I guess, is gcl's printed representation of
>> infinity.
>>
>
> This suggestion is apparently not working for gcl:
> ------------------------------**----------------------------
> (%i1) :lisp (float-inf-p (elt '(100.0 #<1.#INF00e+000>) 1))
>
> Maxima encountered a Lisp error:
>
> Error in MACSYMA-TOP-LEVEL [or a callee]: The default dispatch macro
> signalled an error.
>
> (%i1) :lisp (float-inf-p (elt (list 100.0 #<1.#INF00e+000>) 1))
>
> Maxima encountered a Lisp error:
>
> Error in MACSYMA-TOP-LEVEL [or a callee]: The default dispatch macro
> signalled an error.
>
> (%i1) :lisp (float-inf-p (elt '(100.0 #<1.#INF00e+000>) 0))
>
> Maxima encountered a Lisp error:
>
> Error in MACSYMA-TOP-LEVEL [or a callee]: The default dispatch macro
> signalled an error.
> ------------------------------**-------------------
>
>
> On Mar. 17, 2013, Richard Fateman wrote:
>
>  for  GCL..
>>
>>
>> infp(x):=  ?float\-inf\-p(x);
>>
>> infp(A[2])  will return true  iff A[2] is an infinite floating point
>> object.
>>
>> That's all.  no reading, no writing, no strings.
>>
>> infp(%e^1000.0) returns true.
>> infp(%e^60.0) returns false.
>>
>
> but I am looking for something that works on the lisp code level
> and I get:
>
> ------------------------------**--
> (%i1) infp(x):=  ?float\-inf\-p(x);
> (%o1) infp(x):=?float\-inf\-p(x)
>
> (%i2) :lisp (funcall $infp #<1.#INF00e+000>)
>
> Maxima encountered a Lisp error:
>
> Error in MACSYMA-TOP-LEVEL [or a callee]: The default dispatch macro
> signalled an error.
>
> (%i2) :lisp (float-inf-p #<1.#INF00e+000>)
>
> Maxima encountered a Lisp error:
>
> Error in MACSYMA-TOP-LEVEL [or a callee]: The default dispatch macro
> signalled an error.
> ------------------------------**-----------
> So I am still unable to inspect the elements of the lisp list
> returned by adaptive-plot in the case of f.p. overflow.
>
> Ted
>
>
>
>
>
> ______________________________**_________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/**mailman/listinfo/maxima<http://www.math.utexas.edu/mailman/listinfo/maxima>;
>