|
|
1.1 ! root 1: #ident "@(#)sgs-inc:mc68/math.h 2.3.1.1" ! 2: #ifndef _POLY9 ! 3: extern int errno, signgam; ! 4: ! 5: extern double atof(), frexp(), ldexp(), modf(); ! 6: extern double j0(), j1(), jn(), y0(), y1(), yn(); ! 7: extern double erf(), erfc(); ! 8: extern double exp(), log(), log10(), pow(), sqrt(); ! 9: extern double floor(), ceil(), fmod(), fabs(); ! 10: extern double gamma(); ! 11: extern double hypot(); ! 12: extern int matherr(); ! 13: extern double sinh(), cosh(), tanh(); ! 14: extern double sin(), cos(), tan(), asin(), acos(), atan(), atan2(); ! 15: ! 16: /* some useful constants */ ! 17: #define M_E 2.7182818284590452354 ! 18: #define M_LOG2E 1.4426950408889634074 ! 19: #define M_LOG10E 0.43429448190325182765 ! 20: #define M_LN2 0.69314718055994530942 ! 21: #define M_LN10 2.30258509299404568402 ! 22: #define M_PI 3.14159265358979323846 ! 23: #define M_PI_2 1.57079632679489661923 ! 24: #define M_PI_4 0.78539816339744830962 ! 25: #define M_1_PI 0.31830988618379067154 ! 26: #define M_2_PI 0.63661977236758134308 ! 27: #define M_2_SQRTPI 1.12837916709551257390 ! 28: #define M_SQRT2 1.41421356237309504880 ! 29: #define M_SQRT1_2 0.70710678118654752440 ! 30: #if u3b || u3b5 ! 31: #define MAXFLOAT ((float)3.40282346638528860e+38) ! 32: #endif ! 33: #if mc68000 ! 34: /* This code is an ugly *** C R O C K *** to get around the problems ! 35: ** of cross-compiling float/double constants. The constant in question ! 36: ** is the maximum float/double value. Since the VAX has a smaller range ! 37: ** than the MC68000, it cannot convert MAXFLOAT using the native atof(). ! 38: ** What we do here is define a local constant value whose bits are the ! 39: ** right ones for the MC68000. ! 40: */ ! 41: ! 42: #ifndef __VALUE_H__ ! 43: extern double _MaXdOuBlE_; ! 44: asm(" data 1"); ! 45: asm(" even"); ! 46: asm("_MaXdOuBlE_:"); ! 47: asm(" long 0x7f7fffff"); ! 48: #define __VALUE_H__ /* just do it once */ ! 49: #endif ! 50: #define MAXFLOAT _MaXdOuBlE_ ! 51: #endif ! 52: #if pdp11 || vax ! 53: #define MAXFLOAT ((float)1.701411733192644299e+38) ! 54: #endif ! 55: #if gcos ! 56: #define MAXFLOAT ((float)1.7014118219281863150e+38) ! 57: #endif ! 58: #define HUGE MAXFLOAT ! 59: ! 60: #define _ABS(x) ((x) < 0 ? -(x) : (x)) ! 61: #define _REDUCE(TYPE, X, XN, C1, C2) { \ ! 62: double x1 = (double)(TYPE)X, x2 = X - x1; \ ! 63: X = x1 - (XN) * (C1); X += x2; X -= (XN) * (C2); } ! 64: #define _POLY1(x, c) ((c)[0] * (x) + (c)[1]) ! 65: #define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2]) ! 66: #define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3]) ! 67: #define _POLY4(x, c) (_POLY3((x), (c)) * (x) + (c)[4]) ! 68: #define _POLY5(x, c) (_POLY4((x), (c)) * (x) + (c)[5]) ! 69: #define _POLY6(x, c) (_POLY5((x), (c)) * (x) + (c)[6]) ! 70: #define _POLY7(x, c) (_POLY6((x), (c)) * (x) + (c)[7]) ! 71: #define _POLY8(x, c) (_POLY7((x), (c)) * (x) + (c)[8]) ! 72: #define _POLY9(x, c) (_POLY8((x), (c)) * (x) + (c)[9]) ! 73: ! 74: struct exception { ! 75: int type; ! 76: char *name; ! 77: double arg1; ! 78: double arg2; ! 79: double retval; ! 80: }; ! 81: ! 82: #define DOMAIN 1 ! 83: #define SING 2 ! 84: #define OVERFLOW 3 ! 85: #define UNDERFLOW 4 ! 86: #define TLOSS 5 ! 87: #define PLOSS 6 ! 88: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.