/* Redefine secondary simulation function names to become primary names for systems without a Numeric Data Processor. */ #ifdef NONDP #define _acos acos #define _asin asin #define _atan atan #define _cos cos #define _cosh cosh #define _cot cot #define _exp exp #define _fabs fabs #define _ldexp ldexp #define _log log #define _log10 log10 #define _modf modf #define _pow pow #define _pow2 pow2 #define _sin sin #define _sinh sinh #define _sqrt sqrt #define _tan tan #define _tanh tanh #endif /* Structure to hold information about math exceptions */ struct exception { int type; /* error type */ char *name; /* math function name */ double arg1, arg2; /* function arguments */ double retval; /* proposed return value */ }; /* Exception type codes, found in exception.type */ #define DOMAIN 1 /* domain error */ #define SING 2 /* singularity */ #define OVERFLOW 3 /* overflow */ #define UNDERFLOW 4 /* underflow */ #define TLOSS 5 /* total loss of significance */ #define PLOSS 6 /* partial loss of significance */ /* Error codes generated by basic arithmetic operations (+ - * /) */ #define FPEUND 1 /* underflow */ #define FPEOVF 2 /* overflow */ #define FPEZDV 3 /* zero divisor */ #define FPENAN 4 /* not a number (invalid operation) */ /* Constants */ #define PI 3.14159265358979323846 #define PID2 1.57079632679489661923 /* PI divided by 2 */ #define PID4 0.78539816339744830962 /* PI divided by 4 */ #define I_PI 0.31830988618379067154 /* Inverse of PI */ #define I_PID2 0.63661977236758134308 /* Inverse of PID2 */ #define HUGE 1.797693e308 /* huge value */ #define TINY 2.2e-308 /* tiny value */ #define LOGHUGE 709.778 /* natural log of huge value */ #define LOGTINY -708.396 /* natural log of tiny value */ /* External declarations */ extern int _fperr; /* floating point arithmetic error */ extern int errno; /* UNIX error code */ extern char *ecvt(); extern short *seed48(); extern int atoi(),matherr(); extern long atol(),strtol(),lrand48(),nrand48(),mrand48(),jrand48(); extern double atof(),exp(),log(),log10(),pow(),sqrt(); extern double floor(),ceil(),fmod(),fabs(),frexp(),ldexp(),modf(); extern double sinh(),cosh(),tanh(),sin(),cos(),tan(),cot(),asin(),acos(); extern double atan(),atan2(),except(); extern double drand48(),erand48();