I have noticed a peculiar pattern of decimal points when one number is divided on another. Specifically, see the following example, where I generate ri variable, rank its values, convert those ranks in into percentages. Since there are 10 observations, and rank function assigns values to each one of them from 1 to 10, dividing each value on 10 yields values from 0.1 to 1. However, the problem is many of these values are not strictly rounded to 1 decimal, rather when you double click on them, the values are different. For example, the third value shows .30000001 instead of 0.3.
When I apply if qualifier, the argument fails. For example,
The probblem is not unique with rank, it is general in nature. For example,
Code:
set obs 10 gen ri=uniform() egen rank=rank(ri) egen N=count(ri) gen pc=rank/N
Code:
sort pc assert pc==3 in 3 assertion is false r(9);
Code:
clear input float ri 1 2 3 4 5 6 7 8 9 10 end gen pc=ri/10
Comment