fixed some bugs, added flt_umin

This commit is contained in:
ceriel 1989-07-28 14:13:39 +00:00
parent 3d644d25cb
commit 53ce9da827
5 changed files with 37 additions and 7 deletions

View file

@ -12,6 +12,7 @@ flt_modf.c
flt_mul.c flt_mul.c
flt_nrm.c flt_nrm.c
flt_str2fl.c flt_str2fl.c
flt_umin.c
misc.h misc.h
ucmp.c ucmp.c
flt_arith.3 flt_arith.3

View 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 \ 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_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) \ 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) \ b64_sft.$(SUF) flt_chk.$(SUF) flt_flt2ar.$(SUF) flt_str2fl.$(SUF) \
flt_add.$(SUF) flt_cmp.$(SUF) flt_mul.$(SUF) ucmp.$(SUF) \ flt_add.$(SUF) flt_cmp.$(SUF) flt_mul.$(SUF) ucmp.$(SUF) \
flt_modf.$(SUF) flt_modf.$(SUF) flt_umin.$(SUF)
.SUFFIXES: .$(SUF) .SUFFIXES: .$(SUF)
.c.$(SUF): .c.$(SUF):
@ -65,4 +65,5 @@ flt_add.$(SUF): misc.h flt_arith.h
flt_cmp.$(SUF): misc.h flt_arith.h flt_cmp.$(SUF): misc.h flt_arith.h
flt_mul.$(SUF): misc.h flt_arith.h flt_mul.$(SUF): misc.h flt_arith.h
flt_modf.$(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 ucmp.$(SUF): misc.h flt_arith.h

View file

@ -38,13 +38,16 @@ extern int flt_status;
.B flt_div(e1, e2, e3) .B flt_div(e1, e2, e3)
.B flt_arith *e1, *e2, *e3; .B flt_arith *e1, *e2, *e3;
.PP .PP
.B flt_umin(e)
.B flt_arith *e;
.PP
.B flt_modf(e1, intpart, fractpart) .B flt_modf(e1, intpart, fractpart)
.B flt_arith *e1, *intpart, *fractpart; .B flt_arith *e1, *intpart, *fractpart;
.PP .PP
.B int flt_cmp(e1, e2) .B int flt_cmp(e1, e2)
.B flt_arith *e1, *e2; .B flt_arith *e1, *e2;
.PP .PP
.B int flt_str2flt(s, e) .B flt_str2flt(s, e)
.B char *s; .B char *s;
.B flt_arith *e; .B flt_arith *e;
.PP .PP
@ -111,6 +114,12 @@ by the one indicated by
and stores the result indirectly through and stores the result indirectly through
.IR e3 . .IR e3 .
.PP .PP
.B flt_umin
negates the number indicated by
.I e
and stores the result indirectly through
.IR e .
.PP
.B flt_modf .B flt_modf
splits the number indicated by splits the number indicated by
.I e .I e
@ -176,7 +185,7 @@ characters are stored.
.B flt_arith2flt .B flt_arith2flt
converts the number converts the number
.I n .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 in
.IR e . .IR e .
.PP .PP

View file

@ -402,9 +402,11 @@ flt_flt2str(e, buf, bufsize)
register char *s1; register char *s1;
char Xbuf[NDIG+12]; char Xbuf[NDIG+12];
register char *s = Xbuf; register char *s = Xbuf;
flt_arith e1;
e1 = *e;
flt_status = 0; flt_status = 0;
s1 = flt_ecvt(e,NDIG,&dp,&sign); s1 = flt_ecvt(&e1,NDIG,&dp,&sign);
if (sign) if (sign)
*s++ = '-'; *s++ = '-';
*s++ = *s1++; *s++ = *s1++;
@ -439,6 +441,6 @@ flt_flt2str(e, buf, bufsize)
s = Xbuf; s = Xbuf;
s1 = buf; s1 = buf;
do { do {
*s1++ = *s++; *s1++ = *s;
} while (*s); } while (*s++);
} }

View file

@ -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;
}