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

Re: arithmetic issues



Dr Alan Watson 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?

> Okay. However, I do not find the semantics of fx+ to be especially
> compelling. It depends on an accident of the hardware (the number of
> bits in a fixnum) rather than some more general property of numbers.

No, the semantics of fx+ was designed to support an
efficient portable implementation of bignums and the
rest of the numeric tower.  That semantics is flexible
enough to allow implementors to choose a fixnum range
that corresponds to some property of the hardware, but
does not assume or depend upon any such correspondence.

> It may well be useful to the implementor of the library, but since the
> implementor of the library is likely to be the implementor of the whole
> system, if they need it they can define it.

The implementor of the library would be more likely
to be the implementor of the whole system if the R6RS
were to require all implementations to support the
entire numeric tower.  Even if that were to happen,
many implementors would use our portable implementation
of the tower as their starting point.  If the R6RS does
not require implementations to support the entire tower,
then our portable implementation is likely to become the
library version, contrary to your claim.

> I could then implement a library module for the full tower, including
> flonums. Of course, I would not be able to implement the library module
> efficiently in the base language, but as I'm the implementor that is not
> a real problem -- I define the extensions I need and make them available
> to the library module.
> 
> So, it is possible to have an efficient implementation of flonums in the
> library without forcing them to be exposed in the base language.

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.

Will