home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga ACS 1998 #4
/
amigaacscoverdisc1998-041998.iso
/
utilities
/
shareware
/
dev
/
vbcc
/
machines
/
amiga68k
/
libsrc
/
math
/
math_040o
/
frexp.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS
UTF-8
Wrap
C/C++ Source or Header
|
1997-12-30
|
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;
}