Re: [R] [External] Funky calculations

2022-02-01 Thread Nathan Boeger
I understand this and with C the data type used is important. For this type of calculation, I would normally use a float (basic single precision is all I require). #include void main() { float foo = (0.4 + 0.2 + 0.30 + 0.1) ; printf("foo: %f , foo > 1: %s \n", foo, (foo > 1.0 ? "true" : "fal

Re: [R] [External] Funky calculations

2022-02-01 Thread Bill Dunlap
The base 2 representation of 0.4 repeats the digit sequence 1001 infinitely, hence must be rounded. The problem occurs in C the same as it does in R. bill@Bill-T490:~$ cat a.c #include int main(int argc, char* argv[]) { double d = 0.4 + 0.3 + 0.2 + 0.1; printf("0.4+0.3+0.2+0.1 -> %24.17

Re: [R] [External] Funky calculations

2022-02-01 Thread Richard M. Heiberger
I apologize if my tone came across wrong. I enjoy reading your comments on this list. My goal was to describe what the IEEE and R interpret "careful coding" to be. > On Feb 01, 2022, at 20:42, Avi Gross wrote: > > Richard, > > I think it was fairly clear I was explaining how people do arithm

Re: [R] [External] Funky calculations

2022-02-01 Thread Avi Gross via R-help
Richard, I think it was fairly clear I was explaining how people do arithmetic manually and often truncate or round to some number of decimal places. I said nothing about what R does or what the IEEE standards say and I do not particularly care when making MY point. My point is that humans bef

Re: [R] Survey design for multilevel analysis

2022-02-01 Thread Jim Lemon
Hi Love, I have finally had a chance to look at this more closely. I think that the following link: https://cran.r-project.org/web/packages/survival/vignettes/adjcurve.pdf may be useful. See section 4.2. This is not my area of expertise, but it seems to be a known problem. Perhaps by posting to t

Re: [R] Funky calculations

2022-02-01 Thread Rui Barradas
Hello, Like others have said, this is FAQ 7.31. Try (0.4 + 0.2 + 0 + 0.3 + 0 + 0.1) - 1 on both systems, on one of them it's not zero. Hope this helps, Rui Barradas Às 13:45 de 01/02/2022, Nathan Boeger escreveu: Hello, I found something strange and maybe I am going nuts but this does not

Re: [R] Funky calculations

2022-02-01 Thread Mark Fowler
Sorry, last post I meant not > 1 Sent from Mail for Windows From: Nathan Boeger Sent: Tuesday, February 1, 2022 12:28 PM To: r-help@r-project.org Subject: [R] Funky calculations Hello, I found

Re: [R] Funky calculations

2022-02-01 Thread Ivan Krylov
On Tue, 1 Feb 2022 20:45:40 +0700 Nathan Boeger wrote: > 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 Unfortunately, this always happens when computers approximate real numbers with fractions in binar

Re: [R] Funky calculations

2022-02-01 Thread Kevin Thorpe
This looks like a version of FAQ 7.31. > On Feb 1, 2022, at 8:45 AM, Nathan Boeger wrote: > > [You don't often get email from nboe...@gmail.com. Learn why this is > important at http://aka.ms/LearnAboutSenderIdentification.] > > Hello, > > I found something strange and maybe I am going nuts b

[R] Funky calculations

2022-02-01 Thread Nathan Boeger
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

Re: [R] Repeatability Analysis of Ordinal Data

2022-02-01 Thread Bert Gunter
Package-specific questions for non-standard packages (see https://cran.r-project.org/doc/FAQ/R-FAQ.html#Add-on-packages-in-R for the list of current standard packages) are generally off topic here per the posting guide (linked below). It is suggested there that you contact the package maintainer (?

[R] Repeatability Analysis of Ordinal Data

2022-02-01 Thread Sidoti, Salvatore
Greetings, Colleagues: I have several Likert-type ordinal data sets consisting of animal responses with repeated measures. I was able to implement a CLMM model easily enough with the package `ordinal`. However, the package does not support repeatability analyses. Assuming that I subset my dat