From savicky at cs.cas.cz  Wed Aug 12 13:50:46 2009
From: savicky at cs.cas.cz (Petr Savicky)
Date: Wed, 12 Aug 2009 13:50:46 +0200
Subject: [Rd] identical(0, -0)
In-Reply-To: <20090811100201.GA19381@cs.cas.cz>
References: <mailman.23.1249725606.24224.r-devel@r-project.org>
	<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>
Message-ID: <20090812115046.GA17118@cs.cas.cz>

Let me add the following to the discussion of identical(0, -0).

I would like to suggest to replace the paragraph

  'identical' sees 'NaN' as different from 'NA_real_', but all
  'NaN's are equal (and all 'NA' of the same type are equal).

in ?identical by the following text, which is a correction of my previous
suggestion for the same paragraph

  Components of numerical objects are compared as follows. For non-missing
  values, "==" is used. In particular, '0' and '-0' are considered equal. 
  All 'NA's of the same type are equal and all 'NaN's are equal, although 
  their bit patterns may differ in some cases. 'NA' and 'NaN' are always 
  different. Note also that 1/0 and 1/(-0) are different.

The suggestion for the default of identical(0, -0) is TRUE, because the
negative zero is much less important than NA na NaN and, possibly,
distinguishing 0 and -0 could even be deprecated. Moreover, the argument
of efficiency of memcmp cannot be used here, since there are different
variants of NaN and NA, which should not be distinguished by default.

Petr.



[Rd] identical(0, -0)
Petr Savicky