Subject: Re: LISP for embedded systems
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1999/10/24
Newsgroups: comp.lang.lisp
Message-ID: <7uu2i5$7b40a@fido.engr.sgi.com>
Christopher R. Barry <cbarry@2xtreme.net> wrote, speaking of SIOD:
+---------------
| If a routine produces a number larger than an int, you get a float.
+---------------

(*Hee-hee*)  SIOD has *only* floats!  (Well, C doubles.)

	LISP numberp(LISP x)
	{if FLONUMP(x) return(sym_t); else return(NIL);}
	...
	LISP flocons(double x)
	{LISP z;
	 long n;
	 if ((inums_dim > 0) &&
	     ((x - (n = (long)x)) == 0) &&
	     (x >= 0) &&
	     (n < inums_dim))
	   return(inums[n]);
	 NEWCELL(z,tc_flonum);
	 FLONM(z) = x;
	 return(z);}

An "integer" is just a double that happens to fit in a C "long".
Here's how it tells (in "lprin1g()") whether to print a decimal
point or not:

	    case tc_flonum:
	      n = (long) FLONM(exp);
	      if (((double) n) == FLONM(exp))
		sprintf(tkbuffer,"%ld",n);
	      else
		sprintf(tkbuffer,"%g",FLONM(exp));
	      gput_st(f,tkbuffer);
	      break;

So is it even worse than you thought?  ;-}


-Rob

p.s. Unlike you, though, I still think it has its uses...

-----
Rob Warnock, 8L-846		rpw3@sgi.com
Applied Networking		http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		FAX: 650-933-0511
Mountain View, CA  94043	PP-ASEL-IA