Why does R and my calculator calculate this multip

2019-03-04 02:56发布

问题:

This question already has an answer here:

  • Can the decimal be increased for values come from summary? 2 answers

I don't really know how to better ask this question, but it's simple:

My calculator (and my cellphone's calculator) calculates: 119.533 * 1.0054 = 120.1784782

R calculates: 119.533 * 1.0054 = 120.1785

What is obscurely happening into R that refuses to give me a proper response?

Thank you all in advance.

回答1:

As Ben Bolker and Zheyuan Li explained in the comments, it was just a matter of printing. "Printed representation vs. internally stored object".

The problem is solved by setting options(digits = 16) or print(x, digits = 16).

Thank you guys.



标签: r calc