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

AKCL and MAXIMA on a VAX



I have just succeeded in bringing up AKCL-1-179 and Maxima-4-103
on a 4.3 BSD Unix VAX, compiling with gcc-1.35 .  Aside from some minor
difficulties mentioned later, my main problems seemed to be caused by the VAX
floating point being different from that of the MC68881.

The function parse_number in akcl/c/read.d causes a floating point
overflow when it tries to read "2.938736S-39", which is the value of
(least-positive-short-float), because the value 1.0e39 is computed during
the parsing process.  This string is found in some .data and .o files
that the Lisp reader has to read from.  A diff for the fix follows.

*** read.d~	Mon Jul 17 14:21:05 1989
--- read.d	Thu Jul 20 10:38:46 1989
***************
*** 755,757 ****
  	f = 10.0;
- 	fraction_unit = 1.0;
  	while (d > 0)
--- 755,756 ----
***************
*** 762,769 ****
  			--d;
! 			fraction_unit *= f;
  		}
- 	if (sign > 0)
- 		fraction *= fraction_unit;
- 	else
- 		fraction /= fraction_unit;
  
--- 761,769 ----
  			--d;
! 			/* accumulating into the fraction avoids unnecessary
! 			   over&underflows when exponent part is large */
! 			if (sign > 0)
! 				fraction *= f;
! 			else
! 				fraction /= f;
  		}
  

The reader also overflows upon reading "1.701412S38", which is the
value of (most-positive-short-float) correctly rounded to seven
digits, as found inside maxima/src/cpoly.o, for instance.
Unfortunately, the rounding of 1.7014117S38 up to 1.701412S38 crosses
the line from most-positive to excessively-positive.  I think the
problem lies mostly in the output routines which produce 7/16 digits
for single/double precision numbers.  If you want to print floats and
read them back in with an error of less than one unit in the last
place, you need 8/17 digits of output.

I tried editing akcl/c/print.d and akcl/c/format.c to increase the
default number of digits in floating point output, but my effort
didn't seem to have any effect on what the compiler placed in
maxima/src/cpoly.o .  I couldn't quite figure out what code was
responsible for this output, so I just hand edited the .o file to
avoid the overflow when cpoly.o was loaded.

maxima/README should mention that maxima/bin/add-all-defs needs to
have the local value of KCLDIR edited in.

maxima/bin/kcl-link causes a problem with the /bin/test program,
avoidable by means of this fix:
19c19
< if [ "${SYMB}" = "-s" ] ; then rm -r -f kcl
---
> if [ X"${SYMB}" = X"-s" ] ; then rm -r -f kcl

Makedefs needs to have some explanation (or mechanism) to assure
that INITFORM=(si::build-symbol-table) only if SFASL has a nonempty value.


Vincent Broman,  code 632, Naval Ocean Systems Center, San Diego, CA 92152, USA
Phone: +1 619 553 1641    Internet: broman@nosc.mil   Uucp: sdcsvax!nosc!broman