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

[Scheme-reports] inexact->exact and vice versa



I was trying to puzzle out the exact required behavior of INEXACT->EXACT and EXACT->INEXACT just now. I found the description in the Draft (essentially the same as R5RS) maddeningly vague, and therefore, after reviewing  the R6RS descriptions of EXACT and INEXACT, I came up with the following.  

Draft
-----
INEXACT->EXACT returns an exact representation of z. The value returned is the exact number that is numerically closest to the argument. If an inexact argument has no reasonably close exact equivalent, then a violation of an implementation restriction may be reported.

EXACT->INEXACT returns an inexact representation of z. The value returned is the inexact number that is numerically closest to the argument. If an exact argument has no reasonably close inexact equivalent, then a violation of an implementation restriction may be reported.

These procedures implement the natural one-to-one correspondence between exact and inexact integers throughout an implementation-dependent range. See section 6.2.3.


Suggested wording
-----------------
INEXACT->EXACT returns an exact representation of z. The value returned is the exact number that is numerically closest to the argument. For exact arguments, the result is the same as the argument. For inexact non-integral real arguments, the implementation may return a rational approximation, or may report an implementation violation. For inexact complex arguments, the result is a complex number whose real and imaginary parts are result of applying INEXACT->EXACT to the real and imaginary parts of the argument, respectively. If an inexact argument has no reasonably close exact equivalent, then a violation of an implementation restriction may be reported.

EXACT->INEXACT returns an inexact representation of z. The value returned is the inexact number that is numerically closest to the argument. For inexact arguments, the result is the same as the argument. For exact complex numbers, the result is a complex number whose real and imaginary parts are the result of applying EXACT->INEXACT to the real and imaginary parts of the argument, respectively. If an exact argument has no reasonably close inexact equivalent, then a violation of an implementation restriction may be reported.

These procedures implement the natural one-to-one correspondence between exact and inexact integers throughout an implementation-dependent range. See section 6.2.3.

Note: the names INEXACT->EXACT  and EXACT->INEXACT are historical anomalies; the argument to each of these procedures may be either exact or inexact. 

By the way, when the next draft is prepared, would it be possible to add the hyperref package? I do so like hyperlinks. 

-- vincent

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