Skip to content
This repository was archived by the owner on Aug 26, 2024. It is now read-only.
This repository was 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

Description

@matthew-white

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions