gcl-devel
[Top][All Lists]
Advanced

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

[Gcl-devel] Re: [Maxima] GCL and denormalized numbers


From: Camm Maguire
Subject: [Gcl-devel] Re: [Maxima] GCL and denormalized numbers
Date: 24 Oct 2006 11:13:17 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings, and thanks!

"Robert Dodier" <address@hidden> writes:

> Camm,
> 
> About this code in maxima/src/numerical/f2cl-lib.lisp,
> 
> > (defun d1mach (i)
> >   (ecase i
> >     (1
> >      #-gcl least-positive-normalized-double-float
> >      #+gcl least-positive-double-float)
> >     (2 most-positive-double-float)
> >     (3 double-float-epsilon)
> >     (4 (scale-float double-float-epsilon 1))
> >     (5 (log (float (float-radix 1d0) 1d0) 10d0))))
> 
> The change log at the end of the file says this --
> 
> ;;; Revision 1.48  2002/05/03 17:48:06  rtoy
> ;;; GCL doesn't have least-positive-normalized-{single/double}-float, so
> ;;; use just least-positive-{single/double}-float.
> 
> However GCL does now appear to have least-positive-normalized-double-float
> so it seems like we could erase the #+gcl bit above.
> Considering the commentary in d1mach.f it seems like the
> normalized value is intended. (Btw when were the *-normalized-* bits
> introduced in GCL?)

Maybe around 2.6.6 if memory serves.

> 
> If there are no objections (I have none) and you want to change f2cl-lib.lisp,
> please go ahead. I believe you have write permission for Maxima CVS.
> 

OK, This works as a patch to the Debian maxima package for 5.10.0.

--- maxima-5.10.0.orig/src/numerical/f2cl-lib.lisp
+++ maxima-5.10.0/src/numerical/f2cl-lib.lisp
@@ -1244,17 +1244,15 @@
 ;;  D1MACH( 5) = LOG10(B)
 ;;
 
-#+gcl
-(defconstant least-positive-normalized-double-float 
least-positive-double-float)
-#+gcl
-(defconstant least-positive-normalized-single-float 
least-positive-single-float)
+;; #+gcl
+;; (defconstant least-positive-normalized-double-float 
least-positive-double-float)
+;; #+gcl
+;; (defconstant least-positive-normalized-single-float 
least-positive-single-float)
 
 
 (defun d1mach (i)
   (ecase i
-    (1
-     #-gcl least-positive-normalized-double-float
-     #+gcl least-positive-double-float)
+    (1 least-positive-normalized-double-float)
     (2 most-positive-double-float)
     (3 double-float-epsilon)
     (4 (scale-float double-float-epsilon 1))
@@ -1262,9 +1260,7 @@
 
 (defun r1mach (i)
   (ecase i
-    (1
-     #-gcl least-positive-normalized-single-float
-     #+gcl least-positive-single-float)
+    (1 least-positive-normalized-single-float)
     (2 most-positive-single-float)
     (3 single-float-epsilon)
     (4 (scale-float single-float-epsilon 1))


Would someone mind checking this in?  I'm having difficulties:

address@hidden:/fix/t1/camm/debian/maxima/test$ cvs -z9 -q co -d head maxima
ssh: connect to host cvs.sourceforge.net port 22: No route to host
cvs [checkout aborted]: end of file from server (consult above messages if any)

Take care,

> All the best
> Robert
> 
> PS. Here's some comments from d1mach.f .
> 
> C   D1MACH( 1) = B**(EMIN-1), the smallest positive magnitude.
> C   D1MACH( 2) = B**EMAX*(1 - B**(-T)), the largest magnitude.
> C   D1MACH( 3) = B**(-T), the smallest relative spacing.
> C   D1MACH( 4) = B**(1-T), the largest relative spacing.
> C   D1MACH( 5) = LOG10(B)
> C
> C   Assume double precision numbers are represented in the T-digit,
> C   base-B form
> C
> C              sign (B**E)*( (X(1)/B) + ... + (X(T)/B**T) )
> C
> C   where 0 .LE. X(I) .LT. B for I=1,...,T, 0 .LT. X(1), and
> C   EMIN .LE. E .LE. EMAX.
> C
> C   The values of B, T, EMIN and EMAX are provided in I1MACH as
> C   follows:
> C   I1MACH(10) = B, the base.
> C   I1MACH(14) = T, the number of base-B digits.
> C   I1MACH(15) = EMIN, the smallest exponent E.
> C   I1MACH(16) = EMAX, the largest exponent E.
> _______________________________________________
> Maxima mailing list
> address@hidden
> http://www.math.utexas.edu/mailman/listinfo/maxima
> 
> 
> 

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

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