From: Guillermo J. Rozas Date: Thu, 20 Feb 1992 16:23:58 +0000 (+0000) Subject: Fix bug in modf. It was not preserving the sign of the operand, X-Git-Tag: 20090517-FFI~9666 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=511d0ff88b868847f9318b86cba22d7e2690b754;p=mit-scheme.git Fix bug in modf. It was not preserving the sign of the operand, making floor and ceiling only work for positive values. --- 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); + } } }