_PROTOTYPE( void extend, (unsigned long *from, EXTEND *to, int size));
_PROTOTYPE( void compact, (EXTEND *from, unsigned long *to, int size));
_PROTOTYPE( void _fptrp, (int));
-_PROTOTYPE( SINGLE adf4, (SINGLE s2, SINGLE s1));
-_PROTOTYPE( DOUBLE adf8, (DOUBLE s2, DOUBLE s1));
-_PROTOTYPE( SINGLE sbf4, (SINGLE s2, SINGLE s1));
-_PROTOTYPE( DOUBLE sbf8, (DOUBLE s2, DOUBLE s1));
-_PROTOTYPE( SINGLE dvf4, (SINGLE s2, SINGLE s1));
-_PROTOTYPE( DOUBLE dvf8, (DOUBLE s2, DOUBLE s1));
-_PROTOTYPE( SINGLE mlf4, (SINGLE s2, SINGLE s1));
-_PROTOTYPE( DOUBLE mlf8, (DOUBLE s2, DOUBLE s1));
-_PROTOTYPE( SINGLE ngf4, (SINGLE f));
-_PROTOTYPE( DOUBLE ngf8, (DOUBLE f));
+_PROTOTYPE( void adf4, (SINGLE s2, SINGLE s1));
+_PROTOTYPE( void adf8, (DOUBLE s2, DOUBLE s1));
+_PROTOTYPE( void sbf4, (SINGLE s2, SINGLE s1));
+_PROTOTYPE( void sbf8, (DOUBLE s2, DOUBLE s1));
+_PROTOTYPE( void dvf4, (SINGLE s2, SINGLE s1));
+_PROTOTYPE( void dvf8, (DOUBLE s2, DOUBLE s1));
+_PROTOTYPE( void mlf4, (SINGLE s2, SINGLE s1));
+_PROTOTYPE( void mlf8, (DOUBLE s2, DOUBLE s1));
+_PROTOTYPE( void ngf4, (SINGLE f));
+_PROTOTYPE( void ngf8, (DOUBLE f));
_PROTOTYPE( void zrf4, (SINGLE *l));
_PROTOTYPE( void zrf8, (DOUBLE *z));
-_PROTOTYPE( SINGLE cff4, (DOUBLE src));
-_PROTOTYPE( DOUBLE cff8, (SINGLE src));
-_PROTOTYPE( SINGLE cif4, (int ss, long src));
-_PROTOTYPE( DOUBLE cif8, (int ss, long src));
-_PROTOTYPE( SINGLE cuf4, (int ss, long src));
-_PROTOTYPE( DOUBLE cuf8, (int ss, long src));
+_PROTOTYPE( void cff4, (DOUBLE src));
+_PROTOTYPE( void cff8, (SINGLE src));
+_PROTOTYPE( void cif4, (int ss, long src));
+_PROTOTYPE( void cif8, (int ss, long src));
+_PROTOTYPE( void cuf4, (int ss, long src));
+_PROTOTYPE( void cuf8, (int ss, long src));
_PROTOTYPE( long cfu, (int ds, int ss, DOUBLE src));
_PROTOTYPE( long cfi, (int ds, int ss, DOUBLE src));
_PROTOTYPE( int cmf4, (SINGLE s2, SINGLE s1));
#include "FP_types.h"
-SINGLE
+void
adf4(s2,s1)
SINGLE s1,s2;
{
if (s1 == (SINGLE) 0) {
s1 = s2;
- return s1;
+ return;
}
if (s2 == (SINGLE) 0) {
- return s1;
+ return;
}
extend(&s1,&e1,sizeof(SINGLE));
extend(&s2,&e2,sizeof(SINGLE));
add_ext(&e1,&e2);
compact(&e1,&s1,sizeof(SINGLE));
- return s1;
}
#include "FP_types.h"
-DOUBLE
+void
adf8(s2,s1)
DOUBLE s1,s2;
{
if (s1.d[0] == 0 && s1.d[1] == 0) {
s1 = s2;
- return s1;
+ return;
}
if (s2.d[0] == 0 && s2.d[1] == 0) {
- return s1;
+ return;
}
extend(&s1.d[0],&e1,sizeof(DOUBLE));
extend(&s2.d[0],&e2,sizeof(DOUBLE));
add_ext(&e1,&e2);
compact(&e1,&s1.d[0],sizeof(DOUBLE));
- return s1;
}
#include "FP_types.h"
-SINGLE
+void
cff4(src)
DOUBLE src; /* the source itself - THIS TIME it's DOUBLE */
{
extend(&src.d[0],&buf,sizeof(DOUBLE)); /* no matter what */
compact(&buf,&(src.d[1]),sizeof(SINGLE));
- return *(SINGLE *)&(src.d[1]);
}
#include "FP_types.h"
-DOUBLE
+void
cff8(src)
SINGLE src;
{
extend(&src,&buf,sizeof(SINGLE)); /* no matter what */
compact(&buf, &src,sizeof(DOUBLE));
- return *(DOUBLE *) ((void *) &src);
}
#include "FP_types.h"
-SINGLE
+void
cif4(ss,src)
int ss; /* source size */
long src; /* largest possible integer to convert */
}
if (i_src == 0) {
*result = (SINGLE) 0L;
- return(0L);
+ return;
}
/* ESTABLISHED THAT src != 0 */
/* adjust exponent field */
buf.m1 <<= 16;
nrm_ext(&buf); /* adjust mantissa field */
compact(&buf, result,sizeof(SINGLE)); /* put on stack */
- return(*result);
}
#include "FP_types.h"
-DOUBLE
+void
cif8(ss,src)
int ss; /* source size */
long src; /* largest possible integer to convert */
}
if (i_src == 0) {
zrf8(result);
- return(*result);
+ return;
}
/* ESTABLISHED THAT src != 0 */
/* adjust exponent field */
buf.m1 <<= 16;
nrm_ext(&buf);
compact(&buf,&result->d[0],8);
- return(*result);
}
#include "FP_types.h"
-SINGLE
+void
cuf4(ss,src)
int ss; /* source size */
long src; /* largest possible integer to convert */
}
if (i_src == 0) {
*result = (SINGLE) 0L;
- return (SINGLE) 0L;
+ return;
}
/* ESTABLISHED THAT src != 0 */
/* adjust mantissa field */
nrm_ext(&buf);
compact(&buf,result,4);
- return *result;
}
#include "FP_types.h"
-DOUBLE
+void
cuf8(ss,src)
int ss; /* source size */
long src; /* largest possible integer to convert */
/* adjust mantissa field */
nrm_ext(&buf);
compact(&buf,(unsigned long *) (void *)&ss,8);
- return *((DOUBLE *) (void *)&ss);
}
#include "FP_types.h"
-SINGLE
+void
dvf4(s2,s1)
SINGLE s1,s2;
{
/* do a divide */
div_ext(&e1,&e2);
compact(&e1,&s1,sizeof(SINGLE));
- return s1;
}
#include "FP_types.h"
-DOUBLE
+void
dvf8(s2,s1)
DOUBLE s1,s2;
{
/* do a divide */
div_ext(&e1,&e2);
compact(&e1,&s1.d[0],sizeof(DOUBLE));
- return s1;
}
b64_sft(&e1.mantissa, 63 - e1.exp);
b64_sft(&e1.mantissa, e1.exp - 63); /* "loose" low order bits */
compact(&e1,&(p->ipart),sizeof(SINGLE));
- p->fpart = sbf4(p->ipart, y);
+ extend(&(p->ipart), &e2, sizeof(SINGLE));
+ extend(&y, &e1, sizeof(SINGLE));
+ sub_ext(&e1, &e2);
+ compact(&e1, &(p->fpart), sizeof(SINGLE));
}
b64_sft(&e1.mantissa, 63 - e1.exp);
b64_sft(&e1.mantissa, e1.exp - 63); /* "loose" low order bits */
compact(&e1, &(p->ipart.d[0]), sizeof(DOUBLE));
- p->fpart = sbf8(p->ipart, y);
+ extend(&(p->ipart.d[0]), &e2, sizeof(DOUBLE));
+ extend(&y.d[0], &e1, sizeof(DOUBLE));
+ sub_ext(&e1, &e2);
+ compact(&e1, &(p->fpart.d[0]), sizeof(DOUBLE));
}
#include "FP_types.h"
-SINGLE
+void
mlf4(s2,s1)
SINGLE s1,s2;
{
/* do a multiply */
mul_ext(&e1,&e2);
compact(&e1,&s1,sizeof(SINGLE));
- return(s1);
}
#include "FP_types.h"
-DOUBLE
+void
mlf8(s2,s1)
DOUBLE s1,s2;
{
/* do a multiply */
mul_ext(&e1,&e2);
compact(&e1,&s1.d[0],sizeof(DOUBLE));
- return(s1);
}
#include "get_put.h"
#define OFF ((FL_MSW_AT_LOW_ADDRESS ? 0 : 2) + (FL_MSB_AT_LOW_ADDRESS ? 0 : 1))
-SINGLE
+void
ngf4(f)
SINGLE f;
{
p = (unsigned char *) &f + OFF;
*p ^= 0x80;
}
- return f;
}
#define OFF ((FL_MSL_AT_LOW_ADDRESS ? 0 : 4) + (FL_MSW_AT_LOW_ADDRESS ? 0 : 2) + (FL_MSB_AT_LOW_ADDRESS ? 0 : 1))
-DOUBLE
+void
ngf8(f)
DOUBLE f;
{
p = (unsigned char *) &f + OFF;
*p ^= 0x80;
}
- return f;
}
#include "FP_types.h"
-SINGLE
+void
sbf4(s2,s1)
SINGLE s1,s2;
{
- SINGLE *result = &s1; /* s1 may not be in a register! */
+ EXTEND e1,e2;
if (s2 == (SINGLE) 0) {
- return s1;
+ return;
}
- s2 = ngf4(s2);
- *result = adf4(s2,s1);
- return(s1); /* add and return result */
+ extend(&s1,&e1,sizeof(SINGLE));
+ extend(&s2,&e2,sizeof(SINGLE));
+ sub_ext(&e1,&e2);
+ compact(&e1,&s1,sizeof(SINGLE));
}
-
#include "FP_types.h"
-DOUBLE
+void
sbf8(s2,s1)
DOUBLE s1,s2;
{
- DOUBLE *result = &s1; /* s1 may not be in a register! */
+ EXTEND e1, e2;
if (s2.d[0] == 0 && s2.d[1] == 0) {
- return s1;
+ return;
}
- s2 = ngf8(s2);
- *result = adf8(s2,s1); /* add and return result */
- return(s1);
+ extend(&s1.d[0],&e1,sizeof(DOUBLE));
+ extend(&s2.d[0],&e2,sizeof(DOUBLE));
+ sub_ext(&e1,&e2);
+ compact(&e1,&s1.d[0],sizeof(DOUBLE));
}