[R] Funky calculations

Mark Fowler
Tue, 01 Feb 2022 16:34:21 -0000

This a joke? The values differ between the TRUE and FALSE syntaxes. The FALSE
computes to 1.0, which is not greater than 0.

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows

From: Nathan Boeger<mailto:nboeger at gmail.com>
Sent: Tuesday, February 1, 2022 12:28 PM
To: r-help at r-project.org<mailto:r-help at r-project.org>
Subject: [R] Funky calculations

Hello,

I found something strange and maybe I am going nuts but this does not make
sense:

>  (0.4 + 0.2 + 0 + 0.3 + 0 + 0.1) > 1
[1] TRUE

I tried it on my mac M1 (R v4.1.2) and my Linux box (R v4.0.4). If I use
other values, it does not work (see below). It seems only that combination,
granted I did not try them all.

>  (0.4 + 0.2 + 0 + 0.2 + 0 + 0.2) > 1
[1] FALSE

Am I missing something?

Cheers

-nb

        [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.