Out of range floating point number determination



On Mon, Aug 13, 2012 at 4:03 AM, Rupert Swarbrick <rswarbrick at gmail.com>wrote:

> Stavros Macrakis <macrakis at alum.mit.edu> writes:
> > I'd be interested to know whether this works on other
> > implementations.
>
> Not looking promising on SBCL:
>
>   Maxima 5.28.0 http://maxima.sourceforge.net
>   using Lisp SBCL 1.0.58
>   Distributed under the GNU Public License. See the file COPYING.
>   Dedicated to the memory of William Schelter.
>   The function bug_report() provides bug reporting information.
>   (%i1) non_finite(x) := not is(x-x = 0.0)$
>
>   (%i2) xinf: float(10^400)$
>
>   Maxima encountered a Lisp error:
>
>    Too large to be represented as a DOUBLE-FLOAT:
>     100000000000000000000[...snip lots of zeros...]00
>

If this is anything like cmucl, you will need to catch the error that is
thrown here and return NaN.


>
> Where is the error caught when running under GCL? Or does GCL just not
> raise an error?
>

I think that's the whole issue:  GCL doesn't raise an error.  If it did, we
could handle it in some appropriate way.

Ray