gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Numerical conversion between integral and float


From: Mike Thomas
Subject: [Gcl-devel] Numerical conversion between integral and float
Date: Wed, 18 Feb 2004 11:16:43 +1000

Hi all.

On GCL the following occurs:

==================================================================
>(- (expt 2 (expt 2 (expt 2 (expt 2 2)))) 0.5)

Error in SYSTEM:TOP-LEVEL [or a callee]: Can't print a non-number.

Fast links are on: do (use-fast-links nil) for debugging
Broken at PRIN1.  Type :H for Help.
 1 (Continue) Return to top level.
==================================================================

The integral value is too large for the floating point representation and so
the attempt to convert for subtraction of a float doesn't work:

Corman CL handles this as:

(- (expt 2 (expt 2 (expt 2 (expt 2 2)))) 0.5)
;;; An error occurred in function -:
;;; Error: The number

...Giant number elided by yours truly...

 is too large in magnitude to be converted to a SINGLE-FLOAT
;;; Entering Corman Lisp debug loop.
;;; Use :C followed by an option to exit. Type :HELP for help.
;;; Restart options:
;;; 1   Abort to top level.


LW eval gives:

(- (expt 2 (expt 2 (expt 2 (expt 2 2)))) 0.5)
+1D++0 #| +1D++0 is double-float plus-infinity |#


I like the Corman message best of all, but I don't know if that is the Right
Thing To Do re ANSI and numerical correctness.

Cheers

Mike Thomas.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]