Correctly calculate n_missing_values field when writing variables that
[pspp-builds.git] / src / data / sys-file-writer.c
index acf9d5c0b681d4d702a52b81b6798bc93a54358c..fd663d69b5bc7532d98412eeebf865dcd41d61fa 100644 (file)
@@ -421,7 +421,7 @@ write_variable (struct sfm_writer *w, const struct variable *v)
   /* Number of missing values.  If there is a range, then the
      range counts as 2 missing values and causes the number to be
      negated. */
-  write_int (w, mv_has_range (mv) ? 2 - mv_n_values (mv) : mv_n_values (mv));
+  write_int (w, mv_has_range (mv) ? -2 - mv_n_values (mv) : mv_n_values (mv));
 
   /* Print and write formats. */
   write_format (w, *var_get_print_format (v), seg0_width);