Instructor Notes
This is a placeholder file. Please add content here.
Introduction
R Setup
Instructor Note
Tip: Comparing Numbers
A word of warning about comparing numbers: you should never use
==
to compare two numbers unless they are integers (a data
type which can specifically represent only whole numbers).
Computers may only represent decimal numbers with a certain degree of precision, so two numbers which look the same when printed out by R, may actually have different underlying representations and therefore be different by a small margin of error (called Machine numeric tolerance).
Instead you should use the all.equal
function.
Further reading: http://floating-point-gui.de/
Instructor Note
More precisely, the stored value is a decimal approximation of this fraction called a floating point number.