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

Re: [Scheme-reports] Numerical example (real? -2.5+0.0i)



On Mon, Aug 15, 2011 at 04:18:53AM -0400, Andre van Tonder wrote:
> On Mon, 15 Aug 2011, Jussi Piitulainen wrote:
> 
> > An example in July draft 6.2.5 shows (real? -2.5+0.0i) as #t. The text
> > above the examples says (real? z) if and only if (zero? (imag-part z))
> > and (exact? (imag-part z)). The imag-part is clearly not exact.
> 
> Just off the cuff I thought fully known concrete finite-recision reals such as 
> 0.0 were exact.  How is it not?  There is no uncertainty (no hashes indicated), 
> so it is mathematically equal to an exact rational number.

There's no reason it shouldn't be, but AFAIK all implementations treat it as
a flonum (ie, an inexact number).

This could be changed by having an implementation always prefix flonums by
a #i when printing them back (with write, or otherwise) to indicate it's an
inexact number, and interpreting all decimal numbers as exact too.
However, the report isn't about to prescribe something so radically
different from how common implementations work, I think.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
							-- Donald Knuth

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