home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / graf / fract3.zip / MPMATH.H < prev    next >
C/C++ Source or Header  |  1989-12-18  |  3KB  |  93 lines

  1. #ifndef MPMATH_H
  2. #define MPMATH_H
  3.  
  4. #include <math.h>
  5.  
  6. struct MP {
  7.    int Exp;
  8.     unsigned long Mant;
  9. };
  10.  
  11. struct MPC {
  12.     struct MP r, i;
  13. };
  14.  
  15. extern struct MP MPTrigTable[2][4][256], InvHalfPi, HalfPi, InvLn2, Ln2;
  16. extern int MPaccuracy, MPOverflow;
  17.  
  18. /* Mark Peterson's expanded floating point operators.  Automatically uses
  19.    either the 8086 or 80386 processor type specified in global 'cpu'. If
  20.    the operation results in an overflow (result < 2**(2**14), or division
  21.    by zero) the global 'MPoverflow' is set to one. */
  22.  
  23. extern int cpu;
  24.  
  25. struct MP MPmul(struct MP x, struct MP y);
  26. struct MP MPdiv(struct MP x, struct MP y);
  27. struct MP MPadd(struct MP x, struct MP y);
  28. struct MP MPsub(struct MP x, struct MP y);
  29. struct MP MPabs(struct MP x);
  30. struct MP d2MP(double x);  /* Convert double to type MP */
  31. double *MP2d(struct MP m);  /* Convert type MP to double */
  32. struct MP fg2MP(long x, int fg); /* Convert fudged to type MP */
  33.  
  34.  
  35. int MPcmp(struct MP x, struct MP y);
  36. /* return = -1 if x < y
  37.           = 0 if x == y
  38.           = 1 if x > y */
  39.  
  40. /* Mark Peterson's complex expanded floating point operators */
  41. struct MPC MPCmul(struct MPC x, struct MPC y);
  42. struct MPC MPCdiv(struct MPC x, struct MPC y);
  43. struct MPC MPCadd(struct MPC x, struct MPC y);
  44. struct MPC MPCsub(struct MPC x, struct MPC y);
  45. int MPCcmp(struct MPC x, struct MPC y);
  46. struct MPC MPCpow(struct MPC x, int exp);
  47. struct MPC MPCsqr(struct MPC x);
  48. struct MP MPCmod(struct MPC x);
  49. struct complex MPC2cmplx(struct MPC x);
  50. struct MPC cmplx2MPC(struct complex z);
  51.  
  52. /* Prototypes for direct calling of processor specific routines */
  53. struct MP MPmul086(struct MP x, struct MP y);
  54. struct MP MPdiv086(struct MP x, struct MP y);
  55. struct MP MPadd086(struct MP x, struct MP y);
  56. struct MP MPsub086(struct MP x, struct MP y);
  57. int MPcmp086(struct MP x, struct MP y);
  58. struct MP d2MP086(double x);
  59. double *MP2d086(struct MP m);
  60. struct MP fg2MP086(long x, int fg); 
  61.  
  62. struct MP MPmul386(struct MP x, struct MP y);
  63. struct MP MPdiv386(struct MP x, struct MP y);
  64. struct MP MPadd386(struct MP x, struct MP y);
  65. struct MP MPsub386(struct MP x, struct MP y);
  66. int MPcmp386(struct MP x, struct MP y);
  67. struct MP d2MP386(double x);
  68. double *MP2d386(struct MP m);
  69. struct MP fg2MP386(long x, int fg); 
  70.  
  71. /* function pointer support added by Tim Wegner 12/07/89 */
  72. extern int        (*pMPcmp)(struct MP x, struct MP y);
  73. extern struct MP  (*pMPmul)(struct MP x, struct MP y);
  74. extern struct MP  (*pMPdiv)(struct MP x, struct MP y);
  75. extern struct MP  (*pMPadd)(struct MP x, struct MP y);
  76. extern struct MP  (*pMPsub)(struct MP x, struct MP y);
  77. extern struct MP  (*pd2MP)(double x)                 ;
  78. extern double *   (*pMP2d)(struct MP m)              ;
  79.  
  80.  
  81. /* FPU routines */
  82. extern void FPUaptan387(double *y, double *x, double *atan);
  83. extern void FPUcplxmul(struct complex *x, struct complex *y,
  84.                               struct complex *z);
  85. extern void FPUcplxdiv(struct complex *x, struct complex *y,
  86.                               struct complex *z);
  87. extern void FPUsincos(double *Angle, double *Sin, double *Cos);
  88. extern void FPUsinhcosh(double *Angle, double *Sinh, double *Cosh);
  89. extern void FPUcplxlog(struct complex *x, struct complex *z);
  90.  
  91.  
  92. #endif
  93.