home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1994 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1994.iso
/
win3
/
patches
/
symantec
/
rtlinc.exe
/
MATH.H
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-02
|
6KB
|
230 lines
/*_ math.h Fri Jan 20 1989 Modified by: Walter Bright */
/* Copyright (C) 1985-1989 by Walter Bright */
/* All Rights Reserved */
/* $Revision: 1.3 $ */
#ifndef __MATH_H
#define __MATH_H 1
#if __cplusplus
extern "C" {
#endif
#if __ZTC__ < 0x220
#define HUGE_VAL 1.797693134862315e+308
#else
#define HUGE_VAL __inf
#endif
#ifdef __STDC__
#define __CDECL
#define __STDCALL
#else
#define __CDECL __cdecl
#define __STDCALL __stdcall
#endif
#if __OS2__ && __INTSIZE == 4
#define __CLIB __STDCALL
#else
#define __CLIB __CDECL
#endif
double __CLIB acos(double);
double __CLIB asin(double);
double __CLIB atan(double);
double __CLIB atan2(double,double);
double __CLIB cos(double);
double __CLIB sin(double);
double __CLIB tan(double);
double __CLIB cosh(double);
double __CLIB sinh(double);
double __CLIB tanh(double);
double __CLIB exp(double);
double __CLIB frexp(double,int *);
double __CLIB ldexp(double,int);
double __CLIB log(double);
double __CLIB log10(double);
double __CLIB modf(double,double *);
double __CLIB pow(double,double);
double __CLIB sqrt(double);
double __CLIB ceil(double);
double __CLIB fabs(double);
double __CLIB floor(double);
double __CLIB fmod(double,double);
/* Built-in versions */
#if __ZTC__ >= 0x302
double __CLIB _inline_fabs(double);
#define fabs(d) _inline_fabs(d)
#if __INLINE_8087
double __CLIB _inline_sqrt(double);
#define sqrt(d) _inline_sqrt(d)
#endif
#endif
#ifndef __STDC__ /* non-ANSI stuff */
double __CLIB log1p(double);
double __CLIB expm1(double);
float __CLIB acosf(float);
float __CLIB asinf(float);
float __CLIB atanf(float);
float __CLIB atan2f(float,float);
float __CLIB cosf(float);
float __CLIB sinf(float);
float __CLIB tanf(float);
float __CLIB coshf(float);
float __CLIB sinhf(float);
float __CLIB tanhf(float);
float __CLIB expf(float);
float __CLIB frexpf(float,int *);
float __CLIB ldexpf(float,int);
float __CLIB logf(float);
float __CLIB log10f(float);
float __CLIB modff(float,float *);
float __CLIB powf(float,float);
float __CLIB sqrtf(float);
float __CLIB ceilf(float);
float __CLIB fabsf(float);
float __CLIB floorf(float);
float __CLIB fmodf(float,float);
float __CLIB log1pf(float);
float __CLIB expm1f(float);
long double __CLIB expl(long double x);
/* Built-in versions */
#if __ZTC__ >= 0x302
float __CLIB _inline_fabsf(float);
#define fabsf(f) _inline_fabsf(f)
#if __INLINE_8087
float __CLIB _inline_sqrtf(float);
#define sqrtf(f) _inline_sqrtf(f)
#endif
#endif
#define acosl acos
#define asinl asin
#define _asinl asinl
#define atanl atan
#define _atanl atanl
#define atan2l atan2
#define _atan2l atan2l
#define cosl cos
#define _cosl cos
#define sinl sin
#define _sinl sin
#define tanl tan
#define _tanl tan
#define coshl cosh
#define _coshl cosh
#define sinhl sinh
#define _sinhl sinh
#define tanhl tanh
#define _tanhl tanh
#define expl exp
#define frexpl frexp
#define _frexpl frexp
#define ldexpl ldexp
#define _ldexpl ldexp
#define logl log
#define _logl log
#define log10l log10
#define _log10l log10
#define modfl modf
#define _modfl modf
#define powl pow
#define _powl pow
#define sqrtl sqrt
#define _sqrtl sqrt
#define ceill ceil
#define _ceill ceil
#define fabsl fabs
#define _fabsl fabs
#define floorl floor
#define _floorl floor
#define fmodl fmod
#define _fmodl fmod
#define log1pl log1p
#define expm1l expm1
#define _expl expl
/* Constants that the 8087 supports directly */
#define PI 3.14159265358979323846
#define LOG2 0.30102999566398119521
#define LN2 0.6931471805599453094172321
#define LOG2T 3.32192809488736234787
#define LOG2E 1.4426950408889634074 /* 1/LN2 */
/* For unix compatibility */
#define M_LOG2E LOG2E
#define M_LN2 LN2
#define M_PI PI
#define M_E 2.7182818284590452354
#define M_LOG10E 0.43429448190325182765
#define M_LN10 2.30258509299404568402
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.78539816339744830962
#define M_1_PI 0.31830988618379067154
#define M_2_PI 0.63661977236758134308
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT2 1.41421356237309504880
#define M_SQRT1_2 0.70710678118654752440
/* Struct used with matherr() when a floating point exception occurs */
struct exception
{ int type; /* DOMAIN,SING,... */
char *name; /* pointer to string defining the name of the */
/* function that detected the error */
double arg1; /* first argument to function */
double arg2; /* second argument (if defined) to function */
double retval; /* default return value */
};
#define _exception exception
/* Values for exception.type */
#define DOMAIN 1 /* arguments are out of range for the function */
#define SING 2 /* argument is a singularity */
#define OVERFLOW 3
#define UNDERFLOW 4
#define TLOSS 5 /* total loss of significant digits */
#define PLOSS 6 /* partial loss of significant digits */
#define DIVIDE_BY_ZERO 7
int __CLIB matherr(struct exception *);
double __CLIB atof(const char *);
#define _atold atof
#define _matherr matherr
double __CLIB hypot(double,double);
#define _hypot hypot
#define _hypotl hypot
#define hypotl hypot
double __CLIB poly(double,int,double []);
#if !__cplusplus
struct complex
{
double x,y;
};
#define cabs(z) (hypot(z.x,z.y))
#define complexl complex
#define _cabs cabs
#define cabsl cabs
#define _cabsl cabs
#endif
#endif
#if __cplusplus
}
#endif
#endif /* __MATH_H */