[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] EQV? on numbers should be based on operational equivalence
On Tue, May 8, 2012 at 10:55 AM, Mark H Weaver <mhw@x> wrote:
> Alex Shinn <alexshinn@x> writes:
>> On Tue, May 8, 2012 at 8:42 AM, Mark H Weaver <mhw@x> wrote:
>>> John Cowan <cowan@x> writes:
>>>> Mark H Weaver scripsit:
>>>>
>>>>> In particular, on platforms with signed zeroes, the R7RS should mandate
>>>>> that (eqv? 0.0 -0.0) => #false.
>>>>
>>>> R6RS mandates that, but R7RS currently leaves it unspecified.
>>>
>>> How would you suggest implementing memoization in a portable R7RS
>>> program?
>>
>> It must be unspecified in R7RS because R7RS
>> does not require that implementations distinguish
>> between 0.0 and -0.0, nor that they provide +inf.0
>> or -inf.0.
>
> That's why I qualified my statement with "on platforms with signed
> zeroes". All I am advocating is that EQV? be based on operational
> equivalence, i.e. that we mandate (eqv? 0.0 -0.0) => #true if and only
> if 0.0 and -0.0 are operationally equivalent.
The problem is an implementation may have a
different representation for -0.0 but still not
support +/-inf.0. Trying to to list every case
manually would result in a long chain of if/then/else
statements. It's much better if the desired results
fall out naturally from a simple rule.
This is why we're revisiting all eqv? tickets as
a single item in the next ballot - we should have
a single consistent rule and stick to it. Exception
cases can still be proposed if people really think
they're necessary, but that should be considered
a last resort.
--
Alex
_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports