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
Most attachments are stripped, as was yours. However, even without the info, the answer is very likely FAQ 7.31. Computer arithmetic. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, Apr 7, 2022 at 10:32 AM 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://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.
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&data=04%7C01%7Crmh%40temple.edu%7C415d01fbba264cd4d1ad08da18bc8805%7C716e81efb52244738e3110bd02ccf6e5%7C0%7C0%7C637849495421702100%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=v0xknDQUdAFoQ7HK8fDegMcGLOHuasMkQHq9XqazQlg%3D&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&data=04%7C01%7Crmh%40temple.edu%7C415d01fbba264cd4d1ad08da18bc8805%7C716e81efb52244738e3110bd02ccf6e5%7C0%7C0%7C637849495421702100%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=lVntKkDO9OnmMrZslJhZU8VydPepHERDjSTSsOTb9wY%3D&reserved=0 > and provide commented, minimal, self-contained, reproducible code.