From 511d0ff88b868847f9318b86cba22d7e2690b754 Mon Sep 17 00:00:00 2001 From: "Guillermo J. Rozas" Date: Thu, 20 Feb 1992 16:23:58 +0000 Subject: [PATCH] Fix bug in modf. It was not preserving the sign of the operand, making floor and ceiling only work for positive values. --- v7/src/microcode/missing.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/v7/src/microcode/missing.c b/v7/src/microcode/missing.c index 5433e1142..3a1eb80ec 100644 --- a/v7/src/microcode/missing.c +++ b/v7/src/microcode/missing.c @@ -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); + } } } -- 2.25.1