[Scheme-reports] Definition of expt (was #391 - a selection of error predicates)
Mark H Weaver 08 Aug 2012 11:44 UTC
On 08/08/2012 02:49 AM, Alex Shinn wrote (on the WG1 list):
> These predicates seem random, reflecting only the
> historical precedent of what was stated as "signals
> an error" vs "is an error". I'm not even convinced that
> distinction was made by design rather than the
> stylistic convention of the editors at the time.
>
> For expt, in particular, we added this note ourselves,
> and the actual text is:
>
> 0.0^z is 1.0 if z = 0.0, and 0.0 if (real-part z) is positive.
> For other cases in which the first argument is zero, either
> an error is signalled or an unspecified number is returned.
>
> Apart from the wording being a clumsy, saying
> an "error is signalled _or_ an unspecified result
> is returned" is the same as saying "the result is
> an error."
The text does not say "or an unspecified result is returned". It says
"or an unspecified _number_ is returned". Therefore, it is not the same.
> I propose changing the text to:
>
> 0^z is 1 if z = 0, and 0 if (real-part z) is positive.
> It is an error if (real-part z) is negative.
You've made two questionable changes to the meaning of this definition,
beyond the description of what happens in the error/unspecified case.
1. The current text uses "0.0" and "1.0" which suggests inexact numbers.
You've changed these to exact numbers. I interpret the current text to
apply only when the base is an _inexact_ zero, and to specify inexact
results. I interpret your proposed text as mandating exact return
values, and possibly also applying when the base is an exact zero.
2. In the current text, the error/unspecified case consists of the
following possibilities: (real-part z) is negative, or (real-part z) is
zero and (imag-part z) is non-zero. Your change in wording now fails to
specify the behavior in the latter case.
> [although it should probably also be an error if
> (imag-part z) is non-zero.]
Why do you say that?
Mark
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports