[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] [scheme-reports-wg1] John Cowan's votes and rationales on the seventh ballot
Hi Mark,
On Wed, Sep 19, 2012 at 1:47 PM, Mark H Weaver <mhw@x> wrote:
> On 09/18/2012 11:40 PM, Alex Shinn wrote:
>>
>> On Wed, Sep 19, 2012 at 11:42 AM, Arthur A. Gleckler
>> <scheme@x> wrote:
>>>
>>> On Tue, Sep 18, 2012 at 12:44 AM, John Cowan<cowan@x>
>>> wrote:
>>>>
>>>>
>>>> #121 The semantics of expt for zero bases has been refined
>>>>
>>>> Preferences: r5rs-error, r5rs
>>>>
>>>> Rationale: I agree that the R6RS rule makes no sense in an R7RS
>>>> context. However, it's worth saying explicitly that the oddball zero
>>>> cases are errors.
>>>
>>>
>>> I don't understand. I seem to remember you pointing this out before, but
>>> it
>>> hasn't been fixed: the language for the r5rs-error option is exactly the
>>> same as that for r6rs:
>>>
>>> 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.
>>>
>>> Should that read this way instead?:
>>>
>>> 0.0^z is 1.0 if z = 0.0, and 0.0 if (real-part z) is positive.
>>> It is an error for the first argument to be zero in other cases.
>>>
>>> Or am I misunderstanding the intent of this ballot item?
>>
>>
>> I prefer my earlier wording:
>>
>> The value of 0^z is 1 if (zero? z), 0 if (real-part z)
>> is positive, and an error otherwise. Similarly for 0.0^z,
>> with inexact results.
>
>
> This wording has serious flaws. It suggests that for the cases specified
> above, the exactness of the result depends only on the exactness of the
> base. For example, it suggests that (expt 0 0.0) => 1 and (expt 0.0 0) =>
> 1.0.
If you think the wording is bad, it would be nice if you
suggested an alternate wording. As it is, this is more
clear than R5RS or R6RS, and I was hoping to avoid
listing out all 12 cases of signs and exactness.
I was trying to clean up the simplification "usual rules
of inexact contagion" but we can put that back in,
so that (expt 0 0.0) => 1.0.
> On the contrary, (expt <anything> 0) should yield an exact 1
I disagree, but this is just a convention, and there is
disagreement in the community about whether even
(* 0 x) is allowed to return exact 0 for inexact x.
> Furthermore, I challenge anyone to justify (= 1 (expt 0 0.0)), or for that
> matter the claim that (expt 0 <non-integer>) is well-defined. I'm not aware
> of any established definition for 'expt' that can justify these claims.
(expt 0 1/2) => (sqrt 0) => 0, what's the problem there?
More generally, there is a well-established definition
of complex exponentiation, a simple explanation of
which is in the wikipedia article on the topic.
Given complex numbers w and z with:
w = re^iθ in polar notation
z = c + di
then
w^z = (r^c e^-dθ) [cod(d log(r) + cθ) + i sin(d log(r) + cθ)]
Now when w is 0, then r is 0 and the factor r^c is
only defined when c (i.e. (real-part z)) is positive.
This is following the R6RS convention. Since we've
already accepted the convention that 0^0 is 1, then
we could theoretically allow 0^z when (real-part z) is
0 as well, plugging 1 into the above formula. No one
suggested this and I don't see any reason to break
with the R6RS convention here.
--
Alex
_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports