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

Re: Exactness

Marcin 'Qrczak' Kowalczyk <qrczak@xxxxxxxxxx> writes:

>> So we need a way to query those questions.
> Querying is too late: when program needs a particular characteristic,
> it doesn't help it that it could detect that the implementation
> doesn't meet its expectations.

Oh, so you want to demand that all Scheme systems must implement
whatever feature you need for that program?  How does that go?  

>> Scheme doesn't have "flonums" and that's a good and rational design
>> choice.
> I disagree. There are programs which require flonums or something
> which behave similarly. All Scheme implementations I know and all
> other general-purpose languages I know provide flonums.

No, Scheme does not provide "flonums".  Some Scheme systems provide an
implementation of inexact reals which is similar to the Lisp notion of
a flonum.  But that's not the same thing.

> Consider the example at the end of R5RS run on a typical Scheme
> implementation with floats and ratios, augmented with displaying all
> elements of the lazy list it produces. It runs fine. But when we
> replace the two inexact numbers in the initial state with exact ones
> of the same values, fractions become bigger and bigger, even though
> the growing precision it accumulates is useless: the algorithm is
> inexact to begin with!

But this is not a feature of exactness; it's a feature of the
particular strategy chosen to implement exactness.  (Which does not
mean that I can imagine a different strategy!)  So if you want to
guarantee that the operation remain in constant size, and you
recognize that mathematical division is not such an operation, you
want a different operation: "constant size division".  Constant size
division preferences maintaining the implementation size of the
result to mathematical correctness.

> I want portable flonums.

Do you care whether they are called "portable flonums"?  Can we call
them something else and you will be happy?

I am suggesting that if what you care about is constant-size
operations, that we provide mathematical operations that have that