Fix bug in modf. It was not preserving the sign of the operand,
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Thu, 20 Feb 1992 16:23:58 +0000 (16:23 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Thu, 20 Feb 1992 16:23:58 +0000 (16:23 +0000)
making floor and ceiling only work for positive values.

v7/src/microcode/missing.c

index 5433e11423649ee2cb3d8935cbf94459d37e2fef..3a1eb80eca81d973832969615cc7c7bdeb163a90 100644 (file)
@@ -1,8 +1,8 @@
 /* -*-C-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/missing.c,v 9.28 1992/01/15 03:39:01 jinx Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/missing.c,v 9.29 1992/02/20 16:23:58 jinx Exp $
 
-Copyright (c) 1987-92 Massachusetts Institute of Technology
+Copyright (c) 1987-1992 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -212,8 +212,16 @@ DEFUN (modf, (value, iptr),
              }
          }
       }
-    (*iptr) = n;
-    return (s);
+    if (significand < 0)
+    {
+      (*iptr) = (- n);
+      return (- s);
+    }
+    else
+    {
+      (*iptr) = n;
+      return (s);
+    }
   }
 }