Fix TEMPORARY bug and add regression test.
[pspp-builds.git] / src / sfm-write.c
index 97028a4966f15440b5de0947e3be1436dff5c165..fd500f45c00b42062240d2eeb7bdf24813e083b7 100644 (file)
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    02111-1307, USA. */
 
-/* AIX requires this to be the first thing in the file.  */
 #include <config.h>
-#if __GNUC__
-#define alloca __builtin_alloca
-#else
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#else
-#ifdef _AIX
-#pragma alloca
-#else
-#ifndef alloca                 /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#endif
-#endif
-#endif
-#endif
-
 #include "sfm.h"
 #include "sfmP.h"
 #include <assert.h>
@@ -46,7 +29,6 @@ char *alloca ();
 #include <unistd.h>    /* Required by SunOS4. */
 #endif
 #include "alloc.h"
-#include "approx.h"
 #include "error.h"
 #include "file-handle.h"
 #include "getline.h"
@@ -693,13 +675,13 @@ sfm_write_case (struct file_handle * h, const flt64 *elem, int n_elem)
              *ext->x++ = 255;
               continue;
             }
-         else
+         else if (*elem > INT_MIN && *elem < INT_MAX)
            {
-             int value = *elem < 0 ? *elem - EPSILON : *elem + EPSILON;
+             int value = *elem;
 
              if (value >= 1 - COMPRESSION_BIAS
                  && value <= 251 - COMPRESSION_BIAS
-                 && approx_eq (value, *elem))
+                 && value == *elem)
                 {
                  *ext->x++ = value + COMPRESSION_BIAS;
                   continue;