Re: [Scheme-reports] Installing the floor of the R7RS-large numeric tower Bear 21 Apr 2014 17:38 UTC

On Mon, 2014-04-21 at 11:08 -0400, John Cowan wrote:
> Bear scripsit:

> > Therefore I think the standard should require inexact numbers larger
> > (and smaller) than the maximum (and minimum) values representable
> > as exact numbers.  This may affect the range of exact integers
> > that an implementation chooses to represent.  Or it may affect the
> > representation of inexact numbers, or both.
>
> Does being able to represent +inf.0 and -inf.0 count as representing an
> infinite range of inexact numbers?  If so, this constraint is met by
> doing IEEE.  But if not, then any Scheme with standard bignums and IEEE
> floats violates it.  I am reluctant to say that such implementations
> aren't conformant.

Yes, it does.  +inf.0 and -inf.0 are cheap ways to return
something that is, if not quite right, at least less damaging
nonsense.  The specific problem I want to forbid is where you
have a large exact number, you do some operation that ought
to return a larger result like multiplying by 3 or something,
and instead you get a smaller result (the maximum inexact
representable).  This has happened to me in multiple schemes
of R5RS and earlier standards.  Handling infinities and NaNs
correctly does address it.

If you get +inf.0 instead, that's still nonsense (because
you multiplied something finite by something finite,
mathematically you should have a finite result) but it
is a plain case of implementation restriction (range error)
and won't further mislead and confound by, eg, getting
wrong results from comparisons, sorting into wrong
sequences, etc.  Also, it has a contagion property in that
under further operations it quickly leads to NaNs, so you
won't get a long sequence of different nonsense numbers
in the absence of knowledge that they are nonsense.

Given that we are working with machines of finite memory
and attempting to implement numbers (which are infinite)
we must allow a certain degree of mathematical nonsense
here and there.  Scheme attempts to introduce carefully
controlled mathematical nonsense where absolutely necessary
(inexact numbers, and now infinities and NaNs) and keep the
damage to a minimum otherwise.

			Bear

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports