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

Re: [Scheme-reports] Strong win later reversed: Real numbers have imaginary part #e0

Mark H Weaver scripsit:

> I should mention that Scheme implementations differ in how hard they
> work to preserve exactness information.  For example, (log 1) and
> (sin 0) might return either 0 or 0.0 depending on the implementation,
> and (imag-part 1.0) might return either 0 or 0.0.

That behavior is licensed by the wording of R5RS/R7RS 6.2.2, which permits
non-rational operations to produce inexact results even if exact results
are possible.

> In many (most?) implementations, (imag-part 1.0) => 0.0, 

Both behaviors are licensed by 6.2.2.  Rational operations on inexact
numbers can produce exact results (but are not required to) if the exact
number can't affect the results.  ComplexRepresentations explains which
Schemes support and don't support exact complex numbers and complex
numbers of mixed exactness (which are considered inexact by R7RS).

In my last lifetime,                            John Cowan
I believed in reincarnation;                    http://www.ccil.org/~cowan
in this lifetime,                               cowan@x
I don't.  --Thiagi

Scheme-reports mailing list