home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 4
/
DATAFILE_PDCD4.iso
/
unix
/
unixlib36d
/
src
/
c
/
math
< prev
next >
Wrap
Text File
|
1994-03-08
|
1KB
|
93 lines
#ifdef __STDC__
static char sccs_id[] = "@(#) math.c 1.0 " __DATE__ " HJR";
#else
static char sccs_id[] = "@(#) math.c 1.0 26/9/90 HJR";
#endif
/* math.c (c) Copyright 1990 H.Rogers */
#include <math.h>
#ifdef __STDC__
double
cosh (register double x)
#else
double
cosh (x)
register double x;
#endif
{
return ((exp (x) + exp (-x)) / 2);
}
#ifdef __STDC__
double
sinh (register double x)
#else
double
sinh (x)
register double x;
#endif
{
return ((exp (x) - exp (-x)) / 2);
}
#ifdef __STDC__
double
tanh (register double x)
#else
double
tanh (x)
register double x;
#endif
{
register double x1, x2;
x1 = exp (x);
x2 = exp (-x);
return ((x1 - x2) / (x1 + x2));
}
#ifdef __STDC__
double
frexp (register double x, register int *p)
#else
double
frexp (x, p)
register double x;
register int *p;
#endif
{
register int e = 0;
if (x != 0)
{
while (x < 0.5)
{
x *= 2;
e--;
}
while (x >= 1)
{
x /= 2;
e++;
}
}
*p = e;
return (x);
}
#ifdef __STDC__
double
ldexp (register double x, register int y)
#else
double
ldexp (x, y)
register double x;
register int y;
#endif
{
return (x * pow ((double) 2, (double) y));
}