home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EuroCD 3
/
EuroCD 3.iso
/
Programming
/
vbcc
/
machines
/
amigappc
/
libsrc
/
math
/
frexp.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1998-06-24
|
302 b
|
27 lines
#include <math.h>
double frexp(double x,int *p)
{
int neg,j;
j=neg=0;
if(x<0){
x=-x;
neg=1;
}
if(x>=1){
while(x>=1){
j++;
x/=2;
}
}else if(x<0.5&&x!=0){
while(x<0.5){
j--;
x*=2;
}
}
*p = j;
if(neg) x=-x;
return x;
}