Two
precision issues come up repeatedly when using Stata (and other
similar analysis packages). One is how decimal values are
represented in the computer's memory. The other is how large an
integer you can store in a given Stata data type.
When 0.7 doesn't equal
0.7
Computers use a binary (0's and 1's) system to store decimal
numbers. This leads to some inaccuracy, since some decimal values
can't be stored exactly in binary. Try this:
clear all
set obs 1
gen x= 0.7
list
list if x == 0.7 // 0.7 doesn't equal 0.7
browse
list if x == float(0.7) // now they are equal
You'll notice that the
commandlist if x ==
0.7results in nothing being
listed! When you browse the data, you'll see that 0.7 is being
stored as th