Re: arithmetic issues William D Clinger (18 Jan 2006 20:45 UTC)
Re: arithmetic issues Alan Watson (18 Jan 2006 22:16 UTC)
Re: arithmetic issues Marcin 'Qrczak' Kowalczyk (19 Jan 2006 09:25 UTC)
Re: arithmetic issues Alan Watson (19 Jan 2006 15:03 UTC)
Re: arithmetic issues bear (20 Jan 2006 02:33 UTC)

Re: arithmetic issues Alan Watson 18 Jan 2006 22:16 UTC

William D Clinger wrote:

 >> Hmm. Looking around my office, I see a router, a network-attached
 >> storage device, and a cell phone that all have ARM CPUs without FPUs.
 >
 > Hmmm.  Are you suggesting that those devices must have
 > been programmed in some language that has no float or
 > flonum data type?

No. I am suggesting that you to reconsider your earlier statement that
"most hardware now supports them [flonums] much more efficiently than
they could be implemented in a library module". On all of these devices,
flonums are supported more efficiently in software than in hardware
because they are *not* supported at all in hardware. So, the question
comes down to arguments about "most". Cell phones certainly outnumber
PCs in the country in which I live.

But, anyway, I don't think this likely to be a useful discussion.
Flonums should be available in Scheme on these platforms. The question
is whether flonums should be in the base language or pushed off into a
library. I would say that flonums are not *needed* in the base language
and so should be pushed off into the library.

By "library", I do *not* mean "a body of code implemented in Scheme". I
mean "a set of procedures that can be exposed or not". Libraries can be
implemented in many different ways (e.g., they can be implemented in
Scheme, in machine code, in C, or by enabling options in the
implementation). I know you know that, but I want to avoid confusion.

 > No, the semantics of fx+ was designed to support an
 > efficient portable implementation of bignums and the
 > rest of the numeric tower.

 > Sure, but history shows that some implementors of Scheme
 > have not implemented the full tower---not as a library
 > module, and not in their base implementation.  You seem
 > to be assuming these implementors will all of a sudden
 > become more enthusiastic about doing that.  I take the
 > more realistic position that many of these implementors
 > would prefer to implement only the set of type-specific
 > primitives that suffice for our portable implementation
 > of the full tower.

Would the following proposal satisfy your goals:

(a) Mandate unlimited size exact integers in the base language.

(b) Push fl+ et al. off into a library module.

This would allow users to use your portable code for the full tower
(minus the bignum code that would no longer be needed) and would not
contaminate the base language with unnecessary procedures.

Regards,

Alan
--
Dr Alan Watson
Centro de Radioastronomía y Astrofísica
Universidad Astronómico Nacional de México