From c00d87d077720a895ef8f52732760549e15c3b6d Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Thu, 27 Jan 2011 15:57:38 -0500 Subject: [PATCH] Improve discussion of exactness propagation in manual * doc/ref/api-data.texi (Exact and Inexact Numbers): Improve the discussion of exactness propagation. Mention that there are exceptions to the rule that calculations involving inexact numbers must product an inexact result. --- doc/ref/api-data.texi | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi index b819fcb..1ce9e1e 100755 --- a/doc/ref/api-data.texi +++ b/doc/ref/api-data.texi @@ -712,14 +712,19 @@ Equivalent to @code{scm_is_true (scm_complex_p (val))}. @rnindex exact->inexact @rnindex inexact->exact -R5RS requires that a calculation involving inexact numbers always -produces an inexact result. To meet this requirement, Guile -distinguishes between an exact integer value such as @samp{5} and the -corresponding inexact real value which, to the limited precision +R5RS requires that, with few exceptions, a calculation involving inexact +numbers always produces an inexact result. To meet this requirement, +Guile distinguishes between an exact integer value such as @samp{5} and +the corresponding inexact integer value which, to the limited precision available, has no fractional part, and is printed as @samp{5.0}. Guile will only convert the latter value to the former when forced to do so by an invocation of the @code{inexact->exact} procedure. +The only exception to the above requirement is when the values of the +inexact numbers do not affect the result. For example @code{(expt n 0)} +is @samp{1} for any value of @code{n}, therefore @code{(expt 5.0 0)} is +permitted to return an exact @samp{1}. + @deffn {Scheme Procedure} exact? z @deffnx {C Function} scm_exact_p (z) Return @code{#t} if the number @var{z} is exact, @code{#f} -- 1.5.6.5