home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Education Sampler 1992 [NeXTSTEP]
/
Education_1992_Sampler.iso
/
NeXT
/
GnuSource
/
cc-61.0.1
/
cc
/
math-convex.h
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-08
|
5KB
|
200 lines
#pragma once
#ifndef __HAVE_MATH_CONVEX__
#define __HAVE_MATH_CONVEX__
#define HUGE_VAL 8.98846567431157854e+307
#define HUGE 8.98846567431157854e+307
#define HUGEI 1.79769313486231570e+308
#define M_E 2.71828182845904523536
#define M_LN10 2.30258509299404568402
#define M_LN2 0.69314718055994530942
#define M_LOG10E 0.43429448190325182765
#define M_LOG2E 1.44269504088896340736
#define M_PI 3.14159265358979323846
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.78539816339744830962
#define M_SQRT1_2 0.70710678118654752440
#define M_SQRT2 1.41421356237309504880
#define M_1_PI 0.31830988618379067154
#define M_2_PI 0.63661977236758134308
#define M_2_SQRTPI 1.12837916709551257390
extern const double acos (double x);
extern const double asin (double x);
extern const double atan (double x);
extern const double atan2 (double y, double x);
extern const double atof (const char *p);
extern const double cabs ();
extern const double ceil (double x);
extern const double cos (double x);
extern const double cosh (double x);
extern const double dcvtid (double x);
extern const double exp (double x);
extern const double fabs (double x);
extern const double floor (double x);
extern double frexp (double x, int *ep);
extern const double gamma (double x);
extern const double hypot (double x, double y);
extern const double idcvtd (double x);
extern const double ircvtr (double x);
extern const double j0 (double x);
extern const double j1 (double x);
extern const double jn (int n, double x);
extern const double ldexp (double x, int e);
extern const double log (double x);
extern const double log10 (double x);
extern double modf (double x, double *np);
extern const double pow (double x, double y);
extern const double rcvtir (double x);
extern const double sacos (double x);
extern const double sasin (double x);
extern const double satan (double x);
extern const double satan2 (double x);
extern const double scabs ();
extern const double scos (double x);
extern const double scosh (double x);
extern const double sexp (double x);
extern const double sfabs (double x);
extern const double shypot (double x, double y);
extern const double sin (double x);
extern const double sinh (double x);
extern const double slog (double x);
extern const double slog10 (double x);
extern const double spow (double x);
extern const double sqrt (double x);
extern const double ssin (double x);
extern const double ssinh (double x);
extern const double ssqrt (double x);
extern const double stan (double x);
extern const double stanh (double x);
extern const double tan (double x);
extern const double tanh (double x);
extern const double y0 (double x);
extern const double y1 (double x);
extern const double yn (int n, double x);
extern const long int ipow (int x, int y);
extern const long long int lpow (long long int x, long long int y);
#define fabs(x) __builtin_fabs(x)
#ifdef __convex__
#define frexp(x,y) __inline_frexp(x,y)
#define ldexp(x,y) __inline_ldexp(x,y)
#ifdef __convex_c2__
#define ceil(x) __inline_ceil (x)
#define cos(x) __inline_cos (x)
#define exp(x) __inline_exp (x)
#define floor(x) __inline_floor (x)
#define log(x) __inline_log (x)
#define log10(x) __inline_log10 (x)
#define modf(x,y) __inline_modf ((x), (y))
#define sin(x) __inline_sin (x)
#define sqrt(x) __inline_sqrt (x)
#endif /* __convex_c2__ */
__inline__ static const double __inline_ceil (double x)
{
double z;
__asm__ ("frint.d %1,%0" : "=d" (z) : "d" (x));
if (z < x) z += 1.0;
return z;
}
__inline__ static const double __inline_cos (double x)
{
double z;
__asm__ ("cos.d %0" : "=d" (z) : "0" (x));
return z;
}
__inline__ static const double __inline_exp (double x)
{
double z;
__asm__ ("exp.d %0" : "=d" (z) : "0" (x));
return z;
}
__inline__ static const double __inline_floor (double x)
{
double z;
__asm__ ("frint.d %1,%0" : "=d" (z) : "d" (x));
if (z > x) z -= 1.0;
return z;
}
__inline__ static const double __inline_frexp (double x, int *np)
{
union u {double d; unsigned long long ll;} u;
if ((u.d = x) == 0)
*np = 0;
else
{
*np = ((u.ll >> 52) & 03777) - 02000;
u.ll = (u.ll & 0x800fffffffffffffLL) | ((union u) {0.5}).ll;
}
return u.d;
}
__inline__ static const double __inline_ldexp (double x, int n)
{
extern int errno;
union {double d; long long ll; unsigned sexp : 12;} u;
if ((u.d = x) != 0)
{
int exp = n + (u.sexp & 03777);
if (exp <= 0)
u.ll = 0, errno = 34;
else if (exp > 03777)
u.ll |= 0x7fffffffffffffffLL, errno = 34;
else
u.ll += (long long) n << 52;
}
return u.d;
}
__inline__ static const double __inline_log (double x)
{
double z;
__asm__ ("ln.d %0" : "=d" (z) : "0" (x));
return z;
}
__inline__ static const double __inline_log10 (double x)
{
return M_LOG10E * __log (x);
}
__inline__ static const double __inline_modf (double x, double *np)
{
double intpart;
__asm__ ("frint.d %1,%0" : "=d" (intpart) : "d" (x));
*np = intpart;
return x - intpart;
}
__inline__ static const double __inline_sin (double x)
{
double z;
__asm__ ("sin.d %0" : "=d" (z) : "0" (x));
return z;
}
__inline__ static const double __inline_sqrt (double x)
{
double z;
__asm__ ("sqrt.d %0" : "=d" (z) : "0" (x));
return z;
}
#endif /* __convex__ */
#endif /* __HAVE_MATH_CONVEX__ */