10 |
|
|
11 |
|
#include <stdio.h> |
12 |
|
|
13 |
+ |
#ifndef frexp |
14 |
+ |
extern double frexp(); |
15 |
+ |
#endif |
16 |
+ |
#ifndef ldexp |
17 |
+ |
extern double ldexp(); |
18 |
+ |
#endif |
19 |
|
|
20 |
+ |
|
21 |
|
putstr(s, fp) /* write null-terminated string to fp */ |
22 |
|
register char *s; |
23 |
|
register FILE *fp; |
42 |
|
double f; |
43 |
|
FILE *fp; |
44 |
|
{ |
38 |
– |
extern double frexp(); |
45 |
|
int e; |
46 |
|
|
47 |
|
putint((long)(frexp(f,&e)*0x7fffffff), 4, fp); |
91 |
|
getflt(fp) /* get a floating point number */ |
92 |
|
FILE *fp; |
93 |
|
{ |
94 |
< |
extern double ldexp(); |
94 |
> |
long l; |
95 |
|
double d; |
96 |
|
|
97 |
< |
d = (double)getint(4, fp)/0x7fffffff; |
97 |
> |
l = getint(4, fp); |
98 |
> |
d = (l + (l > 0 ? .5 : -.5)) * (1./0x7fffffff); |
99 |
|
return(ldexp(d, (int)getint(1, fp))); |
100 |
|
} |