[R] [External] Calculation error found

Richard M. Heiberger
Thu, 07 Apr 2022 17:56:55 -0000

Probably numerical precision.  See FAQ 7.31 which is on your computer.
Enter
     system(paste("open",file.path(base::system.file(),
"../../doc/manual/R-FAQ.pdf")))
and the FAQ file will open.

x <- 20
y <- 19.99999999999999
x-y
x == y

> On Apr 07, 2022, at 12:20, Sara Bortot <sarabortot11 at gmail.com>
wrote:
>
> Good evening,
> I was doing some calculations with R when I noticed an error in one of
> the answers.
> I am attaching the screenshot of the page. There you will see that the two
> calculations are written in a different way but they should give the same
> result, because they're equivalent.
> Let me know if it is a solvable problem,
>
> Kind regards
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&amp;data=04%7C01%7Crmh%40temple.edu%7C415d01fbba264cd4d1ad08da18bc8805%7C716e81efb52244738e3110bd02ccf6e5%7C0%7C0%7C637849495421702100%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=v0xknDQUdAFoQ7HK8fDegMcGLOHuasMkQHq9XqazQlg%3D&amp;reserved=0
> PLEASE do read the posting guide
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r-project.org%2Fposting-guide.html&amp;data=04%7C01%7Crmh%40temple.edu%7C415d01fbba264cd4d1ad08da18bc8805%7C716e81efb52244738e3110bd02ccf6e5%7C0%7C0%7C637849495421702100%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=lVntKkDO9OnmMrZslJhZU8VydPepHERDjSTSsOTb9wY%3D&amp;reserved=0
> and provide commented, minimal, self-contained, reproducible code.