needed ldexp routine for exp.c
This commit is contained in:
parent
c09e4ced7e
commit
52a8f7d1f1
1 changed files with 32 additions and 0 deletions
|
@ -11,6 +11,38 @@
|
||||||
#include <pc_err.h>
|
#include <pc_err.h>
|
||||||
extern _trp();
|
extern _trp();
|
||||||
|
|
||||||
|
static double
|
||||||
|
ldexp(fl,exp)
|
||||||
|
double fl;
|
||||||
|
int exp;
|
||||||
|
{
|
||||||
|
extern double _fef();
|
||||||
|
int sign = 1;
|
||||||
|
int currexp;
|
||||||
|
|
||||||
|
if (fl<0) {
|
||||||
|
fl = -fl;
|
||||||
|
sign = -1;
|
||||||
|
}
|
||||||
|
fl = _fef(fl,&currexp);
|
||||||
|
exp += currexp;
|
||||||
|
if (exp > 0) {
|
||||||
|
while (exp>30) {
|
||||||
|
fl *= (double) (1L << 30);
|
||||||
|
exp -= 30;
|
||||||
|
}
|
||||||
|
fl *= (double) (1L << exp);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
while (exp<-30) {
|
||||||
|
fl /= (double) (1L << 30);
|
||||||
|
exp += 30;
|
||||||
|
}
|
||||||
|
fl /= (double) (1L << -exp);
|
||||||
|
}
|
||||||
|
return sign * fl;
|
||||||
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
_exp(x)
|
_exp(x)
|
||||||
double x;
|
double x;
|
||||||
|
|
Loading…
Add table
Reference in a new issue