Skip to content

Commit 4ef6e1e

Browse files
committed
SAS reader: fix value labels for negative numbers
1 parent fdf4e1e commit 4ef6e1e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/sas/readstat_sas7bcat_read.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ static readstat_error_t sas7bcat_parse_value_labels(const char *value_start, siz
107107
sas_assign_tag(&value, (val >> 40));
108108
} else {
109109
memcpy(&dval, &val, 8);
110-
dval *= -1.0;
110+
if (dval > 0.0) {
111+
val = ~val;
112+
memcpy(&dval, &val, 8);
113+
} else {
114+
dval *= -1.0;
115+
}
111116
}
112117

113118
value.v.double_value = dval;

0 commit comments

Comments
 (0)