Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Conversion from double to float when counting differences #20

Open
matthew-white opened this issue Nov 21, 2014 · 0 comments
Open

Conversion from double to float when counting differences #20

matthew-white opened this issue Nov 21, 2014 · 0 comments
Labels

Comments

@matthew-white
Copy link
Collaborator

For float variables, do not count a value as a difference even if it differs from the value in the replacements file as long as the two values' float representation is the same. Example replacements file for the auto dataset:

make varname value
Volvo 260 gear_ratio 2.9800001

E.g., the following code creates this replacements file, then feeds it to readreplace:

clear
set obs 1
gen make = "Volvo 260"
gen varname = "gear_ratio"
gen double value = 2.9800001
tempfile rf
sa `rf'
sysuse auto, clear
tempfile auto
sa `auto'
assert gear_ratio == float(2.9800001) if make == "Volvo 260"
readreplace using `rf', id(make) var(varname) val(value) use
cf _all using `auto'

There is no actual replacement to gear_ratio, which we confirm with cf, because even though gear_ratio != 2.9800001 in that observation, gear_ratio == float(2.9800001). Yet readreplace displays that there is 1 replacement. This is wrong and should be fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant