Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include <stdarg.h>
00037 #include <cmplrs/host.h>
00038
00039 #ifdef MFEF77_C
00040
00041 #include <libftn.h>
00042
00043 long double __qmax(int argcnt, ...)
00044 {
00045 long double arg, maxarg;
00046 va_list ap;
00047
00048 va_start(ap, argcnt);
00049 maxarg = va_arg(ap, double);
00050 while (--argcnt > 0) {
00051 arg = va_arg(ap, double);
00052 if (arg > maxarg) maxarg = arg;
00053 }
00054 va_end(ap);
00055 return maxarg;
00056 }
00057
00058 long double __qmin(int argcnt, ...)
00059 {
00060 long double arg, minarg;
00061 va_list ap;
00062
00063 va_start(ap, argcnt);
00064 minarg = va_arg(ap, double);
00065 while (--argcnt > 0) {
00066 arg = va_arg(ap, double);
00067 if (arg < minarg) minarg = arg;
00068 }
00069 va_end(ap);
00070 return minarg;
00071 }
00072
00073 struct _cpx_float _cpx_make_float_from_long_double(struct _cpx_long_double q)
00074 {
00075 struct _cpx_float t;
00076 t.r = q.r;
00077 t.i = q.i;
00078 return t;
00079 }
00080
00081 struct _cpx_double _cpx_make_double_from_long_double(struct _cpx_long_double q)
00082 {
00083 struct _cpx_double t;
00084 t.r = q.r;
00085 t.i = q.i;
00086 return t;
00087 }
00088
00089 int _xeq_long_double(struct _cpx_long_double a, struct _cpx_long_double b)
00090 {
00091 return a.r == b.r && a.i == b.i;
00092 }
00093
00094 int _xne_long_double(struct _cpx_long_double a, struct _cpx_long_double b)
00095 {
00096 return a.r != b.r || a.i != b.i;
00097 }
00098
00099 struct _cpx_long_double _cpx_long_double(long double r, long double i)
00100 {
00101 struct _cpx_long_double t;
00102 t.r = r;
00103 t.i = i;
00104 return t;
00105 }
00106
00107 struct _cpx_long_double _cpx_make_long_double_from_float(struct _cpx_float f)
00108 {
00109 struct _cpx_long_double t;
00110 t.r = f.r;
00111 t.i = f.i;
00112 return t;
00113 }
00114
00115 struct _cpx_long_double _cpx_make_long_double_from_double(struct _cpx_double d)
00116 {
00117 struct _cpx_long_double t;
00118 t.r = d.r;
00119 t.i = d.i;
00120 return t;
00121 }
00122
00123 struct _cpx_long_double _xnegate_long_double(struct _cpx_long_double a)
00124 {
00125 struct _cpx_long_double t;
00126 t.r = -a.r;
00127 t.i = -a.i;
00128 return t;
00129 }
00130
00131 struct _cpx_long_double _xadd_long_double(struct _cpx_long_double a, struct _cpx_long_double b)
00132 {
00133 struct _cpx_long_double t;
00134 t.r = a.r + b.r;
00135 t.i = a.i + b.i;
00136 return t;
00137 }
00138
00139 struct _cpx_long_double _xsubtract_long_double(struct _cpx_long_double a, struct _cpx_long_double b)
00140 {
00141 struct _cpx_long_double t;
00142 t.r = a.r - b.r;
00143 t.i = a.i - b.i;
00144 return t;
00145 }
00146
00147 struct _cpx_long_double _xmultiply_long_double(struct _cpx_long_double a, struct _cpx_long_double b)
00148 {
00149 struct _cpx_long_double t;
00150 t.r = a.r*b.r - a.i*b.i;
00151 t.i = a.i*b.r + a.r*b.i;
00152 return t;
00153 }
00154
00155 struct _cpx_long_double _xdivide_long_double(struct _cpx_long_double a, struct _cpx_long_double b)
00156 {
00157 struct _cpx_long_double t;
00158 long double d = b.r*b.r+b.i*b.i;
00159 t.r = (a.r*b.r+a.i*b.i)/d;
00160 t.i = (a.i*b.r-a.r*b.i)/d;
00161 return t;
00162 }
00163
00164
00165
00166
00167
00168
00169
00170 struct _cpx_long_double pow_cqi_stub(struct _cpx_long_double *a, int *b)
00171 {
00172 struct _cpx_long_double temp;
00173 __pow_cqi(&temp,a,b);
00174 return temp;
00175 }
00176
00177 struct _cpx_long_double pow_cql_stub(struct _cpx_long_double *a, long long *b)
00178 {
00179 struct _cpx_long_double temp;
00180 __pow_cql(&temp,a,b);
00181 return temp;
00182 }
00183
00184 struct _cpx_long_double pow_cq_stub(struct _cpx_long_double *a, struct _cpx_long_double *b)
00185 {
00186 struct _cpx_long_double temp;
00187 __cq_pow(&temp,a,b);
00188 return temp;
00189 }
00190 #endif
00191