From maechler at stat.math.ethz.ch  Sat Aug 22 00:00:44 2009
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Sat, 22 Aug 2009 00:00:44 +0200
Subject: [Rd] identical(0, -0)
In-Reply-To: <20090812162013.GA13341@cs.cas.cz>
References: <4A7D8E08.2070300@uottawa.ca> <20090810092141.GC10119@cs.cas.cz>
	<4A7FECCD.2010208@stats.uwo.ca>
	<353CA09D-6769-4F58-AC2C-B7AD2CF5DE0C@r-project.org>
	<4A802CB7.3030806@stats.uwo.ca> <4A804219.3080803@stats.uwo.ca>
	<19073.9732.319993.862295@lynne.math.ethz.ch>
	<20090811100201.GA19381@cs.cas.cz>
	<20090812115046.GA17118@cs.cas.cz>
	<19074.52084.426535.783434@lynne.math.ethz.ch>
	<20090812162013.GA13341@cs.cas.cz>
Message-ID: <19087.6412.268313.740003@deb4.math.ethz.ch>

I have taken up the issue now,
and after thinking, studying the source, trying to define a
'method = <string>' argument, came to the conclusion that both
the implementation and documentation (and source code "self-explanation")
are easiest to program, maintain, and understand,
if I introduce explicit binary switches,
so I now  propose the following R-level interface which keeps
the current behavior the default:

>> Usage:
>> 
>>      identical(x, y, num.EQ = TRUE, one.NA = TRUE, attrib.asSet = TRUE)
>> 
>> Arguments:
>> 
>>     x, y: any R objects.
>> 
>>   num.EQ: logical indicating if ('double' and 'complex' non-'NA')
>>           numbers should be compared using '==', or by bitwise
>>           comparison.  The latter (non-default) differentiates between
>>           '-0' and '+0'.
>> 
>>   one.NA: logical indicating if there is conceptually just one numeric
>>           'NA' and one 'NaN';  'one.NA = FALSE' differentiates bit
>>           patterns.
>> 
>> attrib.asSet: logical indicating if 'attributes' of 'x' and 'y' should
>>           be treated as _unordered_ tagged pairlists ("sets"); this
>>           currently also applies to 'slot's of S4 objects.  It may well
>>           be too strict to set 'attrib.asSet = FALSE'. 

I'm open for better names of arguments, but will not accept "_"
in the argument names {just my taste; no reason for argueing...}.

I've practically finished both C- and R- and Rd-code, but can
still adapt to proposals if there are good reasons for it.

Martin Maechler, ETH Zurich



[Rd] identical(0, -0)
Martin Maechler