fixed some bugs, added flt_umin
authorceriel <none@none>
Fri, 28 Jul 1989 14:13:39 +0000 (14:13 +0000)
committerceriel <none@none>
Fri, 28 Jul 1989 14:13:39 +0000 (14:13 +0000)
modules/src/flt_arith/.distr
modules/src/flt_arith/Makefile
modules/src/flt_arith/flt_arith.3
modules/src/flt_arith/flt_str2fl.c
modules/src/flt_arith/flt_umin.c [new file with mode: 0644]

index c8ef39c..ff15ca6 100644 (file)
@@ -12,6 +12,7 @@ flt_modf.c
 flt_mul.c
 flt_nrm.c
 flt_str2fl.c
+flt_umin.c
 misc.h
 ucmp.c
 flt_arith.3
index 3efb70b..8a8eeb2 100644 (file)
@@ -13,11 +13,11 @@ LIBFLT = libflt.$(LIBSUF)
 
 SRC =  b64_add.c flt_ar2flt.c flt_div.c flt_nrm.c b64_sft.c flt_chk.c \
        flt_flt2ar.c flt_str2fl.c flt_add.c flt_cmp.c flt_mul.c ucmp.c \
-       flt_modf.c
+       flt_modf.c flt_umin.c
 OBJ =  b64_add.$(SUF) flt_ar2flt.$(SUF) flt_div.$(SUF) flt_nrm.$(SUF) \
        b64_sft.$(SUF) flt_chk.$(SUF) flt_flt2ar.$(SUF) flt_str2fl.$(SUF) \
        flt_add.$(SUF) flt_cmp.$(SUF) flt_mul.$(SUF) ucmp.$(SUF) \
-       flt_modf.$(SUF)
+       flt_modf.$(SUF) flt_umin.$(SUF)
 
 .SUFFIXES:     .$(SUF)
 .c.$(SUF):
@@ -65,4 +65,5 @@ flt_add.$(SUF):       misc.h flt_arith.h
 flt_cmp.$(SUF):        misc.h flt_arith.h
 flt_mul.$(SUF):        misc.h flt_arith.h
 flt_modf.$(SUF):       misc.h flt_arith.h
+flt_umin.$(SUF):       misc.h
 ucmp.$(SUF):   misc.h flt_arith.h
index 8deaef5..dfe27db 100644 (file)
@@ -38,13 +38,16 @@ extern int  flt_status;
 .B flt_div(e1, e2, e3)
 .B flt_arith *e1, *e2, *e3;
 .PP
+.B flt_umin(e)
+.B flt_arith *e;
+.PP
 .B flt_modf(e1, intpart, fractpart)
 .B flt_arith *e1, *intpart, *fractpart;
 .PP
 .B int flt_cmp(e1, e2)
 .B flt_arith *e1, *e2;
 .PP
-.B int flt_str2flt(s, e)
+.B flt_str2flt(s, e)
 .B char *s;
 .B flt_arith *e;
 .PP
@@ -111,6 +114,12 @@ by the one indicated by
 and stores the result indirectly through
 .IR e3 .
 .PP
+.B flt_umin
+negates the number indicated by
+.I e
+and stores the result indirectly through
+.IR e .
+.PP
 .B flt_modf
 splits the number indicated by
 .I e
@@ -176,7 +185,7 @@ characters are stored.
 .B flt_arith2flt
 converts the number
 .I n
-to the floating point format use in this package and returns the result
+to the floating point format used in this package and returns the result
 in
 .IR e .
 .PP
index 22e888a..bc178a1 100644 (file)
@@ -402,9 +402,11 @@ flt_flt2str(e, buf, bufsize)
        register char *s1;
        char Xbuf[NDIG+12];
        register char *s = Xbuf;
+       flt_arith e1;
 
+       e1 = *e;
        flt_status = 0;
-       s1 = flt_ecvt(e,NDIG,&dp,&sign);
+       s1 = flt_ecvt(&e1,NDIG,&dp,&sign);
         if (sign)
                 *s++ = '-';
         *s++ = *s1++;
@@ -439,6 +441,6 @@ flt_flt2str(e, buf, bufsize)
        s = Xbuf;
        s1 = buf;
        do {
-               *s1++ = *s++;
-       } while (*s);
+               *s1++ = *s;
+       } while (*s++);
 }
diff --git a/modules/src/flt_arith/flt_umin.c b/modules/src/flt_arith/flt_umin.c
new file mode 100644 (file)
index 0000000..f82c971
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
+  See the copyright notice in the ACK home directory, in the file "Copyright".
+*/
+
+/* $Header$ */
+
+#include "misc.h"
+
+flt_umin(e)
+       flt_arith *e;
+{
+       /*      Unary minus
+       */
+       flt_status = 0;
+       e->flt_sign = ! e->flt_sign;
+}