[Rd] Representation of floating point numbers (PR#1281)

Winfried Theis theis@statistik.uni-dortmund.de
Thu, 24 Jan 2002 15:15:58 -0000 (GMT)

On 24-Jan-02 Göran Broström wrote:
> On Thu, 24 Jan 2002 theis@statistik.uni-dortmund.de wrote:
>> On 24-Jan-02 Prof Brian Ripley wrote:
>> > 
>> > There is a function all.equal provided for this purpose: it is a misuse of
>> > ==.
>> But there is no hint or note on the "Comparisons" help page concerning this
>> problem. If it is a misuse one should be warned against it.
> But there is a warning there:
> Don't use == and != for tests, such as in if expressions, where you must 
> get a single TRUE or FALSE. Unless you are absolutely sure that nothing 
> unusual can happen, you should use the identical function instead.
> And 'identical' suggests:
>> identical(all.equal(x, y), TRUE)
> Clever indeed!
Sorry for being imprecise here: I missed the hint on all.equal on that page.

My main problem is that I need to find the places of a numerical vector x where
it equals its maximum, so usually I would do

> x[x==max(x)]

and this led to this whole discussion. I may be a bit dumb today but I don't
see an easy way to solve this with identical or all.equal. -- But please don't
bother, for the time being I will just round in the appropriate places. 

Sorry to have bothered you all with this.

Winfried Theis
E-Mail: Winfried Theis <theis@statistik.uni-dortmund.de>
Date: 24-Jan-02
Time: 15:04:41
Dipl.-Math. Winfried Theis, Fachbereich Statistik, Graduiertenkolleg
"Angewandte Statistik"
Universität Dortmund, 44221 Dortmund
Tel.: +49-231-755-5903  FAX: +49-231-755-4387
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch