| 1 | /* math.h (emx+gcc) */
|
|---|
| 2 |
|
|---|
| 3 | #ifndef _EMXMATH_H
|
|---|
| 4 | #define _EMXMATH_H
|
|---|
| 5 |
|
|---|
| 6 | #ifndef CRTWRAP
|
|---|
| 7 | #define CRTWRAP(a) emx_##a
|
|---|
| 8 | #endif
|
|---|
| 9 |
|
|---|
| 10 | #if defined (__cplusplus)
|
|---|
| 11 | extern "C" {
|
|---|
| 12 | #endif
|
|---|
| 13 |
|
|---|
| 14 | #define HUGE_VAL 1e9999
|
|---|
| 15 |
|
|---|
| 16 | #define acos CRTWRAP(acos)
|
|---|
| 17 | #define asin CRTWRAP(asin)
|
|---|
| 18 | #define atan CRTWRAP(atan)
|
|---|
| 19 | #define atan2 CRTWRAP(atan2)
|
|---|
| 20 | #define cbrt CRTWRAP(cbrt)
|
|---|
| 21 | #define ceil CRTWRAP(ceil)
|
|---|
| 22 | #define cos CRTWRAP(cos)
|
|---|
| 23 | #define cosh CRTWRAP(cosh)
|
|---|
| 24 | #define exp CRTWRAP(exp)
|
|---|
| 25 | #define fabs CRTWRAP(fabs)
|
|---|
| 26 | #define floor CRTWRAP(floor)
|
|---|
| 27 | #define fmod CRTWRAP(fmod)
|
|---|
| 28 | #define frexp CRTWRAP(frexp)
|
|---|
| 29 | #define hypot CRTWRAP(hypot)
|
|---|
| 30 | #define ldexp CRTWRAP(ldexp)
|
|---|
| 31 | #define log CRTWRAP(log)
|
|---|
| 32 | #define log10 CRTWRAP(log10)
|
|---|
| 33 | #define modf CRTWRAP(modf)
|
|---|
| 34 | #define pow CRTWRAP(pow)
|
|---|
| 35 | #define rint CRTWRAP(rint)
|
|---|
| 36 | #define sin CRTWRAP(sin)
|
|---|
| 37 | #define sinh CRTWRAP(sinh)
|
|---|
| 38 | #define sqrt CRTWRAP(sqrt)
|
|---|
| 39 | #define tan CRTWRAP(tan)
|
|---|
| 40 | #define tanh CRTWRAP(tanh)
|
|---|
| 41 | #define trunc CRTWRAP(trunc)
|
|---|
| 42 |
|
|---|
| 43 | double acos (double);
|
|---|
| 44 | double asin (double);
|
|---|
| 45 | double atan (double);
|
|---|
| 46 | double atan2 (double, double);
|
|---|
| 47 | double cbrt (double);
|
|---|
| 48 | double ceil (double);
|
|---|
| 49 | double cos (double);
|
|---|
| 50 | double cosh (double);
|
|---|
| 51 | double exp (double);
|
|---|
| 52 | double fabs (double);
|
|---|
| 53 | double floor (double);
|
|---|
| 54 | double fmod (double, double);
|
|---|
| 55 | double frexp (double, int *);
|
|---|
| 56 | double hypot (double, double);
|
|---|
| 57 | double ldexp (double, int);
|
|---|
| 58 | double log (double);
|
|---|
| 59 | double log10 (double);
|
|---|
| 60 | double modf (double, double *);
|
|---|
| 61 | double pow (double, double);
|
|---|
| 62 | double rint (double);
|
|---|
| 63 | double sin (double);
|
|---|
| 64 | double sinh (double);
|
|---|
| 65 | double sqrt (double);
|
|---|
| 66 | double tan (double);
|
|---|
| 67 | double tanh (double);
|
|---|
| 68 | double trunc (double);
|
|---|
| 69 |
|
|---|
| 70 | #if !defined (__NO_C9X)
|
|---|
| 71 |
|
|---|
| 72 | #define HUGE_VALF 1e9999F
|
|---|
| 73 | #define HUGE_VALL 1e9999L
|
|---|
| 74 | #define INFINITY 1e9999 /* TODO: float_t */
|
|---|
| 75 | #define NAN (0.0/0.0) /* TODO: Exceptions, float_t */
|
|---|
| 76 |
|
|---|
| 77 | #define DECIMAL_DIG 21
|
|---|
| 78 |
|
|---|
| 79 | #define FP_ZERO 0
|
|---|
| 80 | #define FP_SUBNORMAL 1
|
|---|
| 81 | #define FP_NORMAL 2
|
|---|
| 82 | #define FP_INFINITE 3
|
|---|
| 83 | #define FP_NAN 4
|
|---|
| 84 |
|
|---|
| 85 | #define fpclassify(x) \
|
|---|
| 86 | ((sizeof (x) == sizeof (float)) ? emx___fpclassifyf (x) \
|
|---|
| 87 | : (sizeof (x) == sizeof (double)) ? emx___fpclassify (x) \
|
|---|
| 88 | : emx___fpclassifyl (x))
|
|---|
| 89 |
|
|---|
| 90 | #define signbit(x) \
|
|---|
| 91 | ((sizeof (x) == sizeof (float)) ? emx___signbitf (x) \
|
|---|
| 92 | : (sizeof (x) == sizeof (double)) ? emx___signbit (x) \
|
|---|
| 93 | : emx___signbitl (x))
|
|---|
| 94 |
|
|---|
| 95 | #define isfinite(x) \
|
|---|
| 96 | ((sizeof (x) == sizeof (float)) ? emx___isfinitef (x) \
|
|---|
| 97 | : (sizeof (x) == sizeof (double)) ? emx___isfinite (x) \
|
|---|
| 98 | : emx___isfinitel (x))
|
|---|
| 99 |
|
|---|
| 100 | #define isnormal(x) \
|
|---|
| 101 | ((sizeof (x) == sizeof (float)) ? emx___isnormalf (x) \
|
|---|
| 102 | : (sizeof (x) == sizeof (double)) ? emx___isnormal (x) \
|
|---|
| 103 | : emx___isnormall (x))
|
|---|
| 104 |
|
|---|
| 105 | #define isnan(x) \
|
|---|
| 106 | ((sizeof (x) == sizeof (float)) ? emx___isnanf (x) \
|
|---|
| 107 | : (sizeof (x) == sizeof (double)) ? emx___isnan (x) \
|
|---|
| 108 | : emx___isnanl (x))
|
|---|
| 109 |
|
|---|
| 110 | #define copysignf CRTWRAP(copysignf)
|
|---|
| 111 | #define copysign CRTWRAP(copysign)
|
|---|
| 112 | #define copysignl CRTWRAP(copysignl)
|
|---|
| 113 |
|
|---|
| 114 | float copysignf (float, float);
|
|---|
| 115 | double copysign (double, double);
|
|---|
| 116 | long double copysignl (long double, long double);
|
|---|
| 117 |
|
|---|
| 118 | #define nextafterf CRTWRAP(nextafterf)
|
|---|
| 119 | #define nextafter CRTWRAP(nextafter)
|
|---|
| 120 | #define nextafterl CRTWRAP(nextafterl)
|
|---|
| 121 |
|
|---|
| 122 | float nextafterf (float, float);
|
|---|
| 123 | double nextafter (double, double);
|
|---|
| 124 | long double nextafterl (long double, long double);
|
|---|
| 125 |
|
|---|
| 126 | #define acosl CRTWRAP(acosl)
|
|---|
| 127 | #define asinl CRTWRAP(asinl)
|
|---|
| 128 | #define atanl CRTWRAP(atanl)
|
|---|
| 129 | #define atan2l CRTWRAP(atan2l)
|
|---|
| 130 | #define cbrtl CRTWRAP(cbrtl)
|
|---|
| 131 | #define ceill CRTWRAP(ceill)
|
|---|
| 132 | #define cosl CRTWRAP(cosl)
|
|---|
| 133 | #define coshl CRTWRAP(coshl)
|
|---|
| 134 | #define expl CRTWRAP(expl)
|
|---|
| 135 | #define fabsl CRTWRAP(fabsl)
|
|---|
| 136 | #define floorl CRTWRAP(floorl)
|
|---|
| 137 | #define fmodl CRTWRAP(fmodl)
|
|---|
| 138 | #define frexpl CRTWRAP(frexpl)
|
|---|
| 139 | #define hypotl CRTWRAP(hypotl)
|
|---|
| 140 | #define ldexpl CRTWRAP(ldexpl)
|
|---|
| 141 | #define logl CRTWRAP(logl)
|
|---|
| 142 | #define log10l CRTWRAP(log10l)
|
|---|
| 143 | #define modfl CRTWRAP(modfl)
|
|---|
| 144 | #define powl CRTWRAP(powl)
|
|---|
| 145 | #define rintl CRTWRAP(rintl)
|
|---|
| 146 | #define sinl CRTWRAP(sinl)
|
|---|
| 147 | #define sinhl CRTWRAP(sinhl)
|
|---|
| 148 | #define sqrtl CRTWRAP(sqrtl)
|
|---|
| 149 | #define tanl CRTWRAP(tanl)
|
|---|
| 150 | #define tanhl CRTWRAP(tanhl)
|
|---|
| 151 | #define truncl CRTWRAP(truncl)
|
|---|
| 152 |
|
|---|
| 153 | long double acosl (long double);
|
|---|
| 154 | long double asinl (long double);
|
|---|
| 155 | long double atanl (long double);
|
|---|
| 156 | long double atan2l (long double, long double);
|
|---|
| 157 | long double cbrtl (long double);
|
|---|
| 158 | long double ceill (long double);
|
|---|
| 159 | long double cosl (long double);
|
|---|
| 160 | long double coshl (long double);
|
|---|
| 161 | long double expl (long double);
|
|---|
| 162 | long double fabsl (long double);
|
|---|
| 163 | long double floorl (long double);
|
|---|
| 164 | long double fmodl (long double, long double);
|
|---|
| 165 | long double frexpl (long double, int *);
|
|---|
| 166 | long double hypotl (long double, long double);
|
|---|
| 167 | long double ldexpl (long double, int);
|
|---|
| 168 | long double logl (long double);
|
|---|
| 169 | long double log10l (long double);
|
|---|
| 170 | long double modfl (long double, long double *);
|
|---|
| 171 | long double powl (long double, long double);
|
|---|
| 172 | long double rintl (long double);
|
|---|
| 173 | long double sinl (long double);
|
|---|
| 174 | long double sinhl (long double);
|
|---|
| 175 | long double sqrtl (long double);
|
|---|
| 176 | long double tanl (long double);
|
|---|
| 177 | long double tanhl (long double);
|
|---|
| 178 | long double truncl (long double);
|
|---|
| 179 |
|
|---|
| 180 | /* Internal funcs, no change */
|
|---|
| 181 |
|
|---|
| 182 | int emx___fpclassify (double);
|
|---|
| 183 | int emx___fpclassifyf (float);
|
|---|
| 184 | int emx___fpclassifyl (long double);
|
|---|
| 185 |
|
|---|
| 186 | int emx___signbit (double);
|
|---|
| 187 | int emx___signbitf (float);
|
|---|
| 188 | int emx___signbitl (long double);
|
|---|
| 189 |
|
|---|
| 190 | int emx___isfinite (double);
|
|---|
| 191 | int emx___isfinitef (float);
|
|---|
| 192 | int emx___isfinitel (long double);
|
|---|
| 193 |
|
|---|
| 194 | int emx___isnormal (double);
|
|---|
| 195 | int emx___isnormalf (float);
|
|---|
| 196 | int emx___isnormall (long double);
|
|---|
| 197 |
|
|---|
| 198 | int emx___isnan (double);
|
|---|
| 199 | int emx___isnanf (float);
|
|---|
| 200 | int emx___isnanl (long double);
|
|---|
| 201 |
|
|---|
| 202 | #endif
|
|---|
| 203 |
|
|---|
| 204 | #if !defined (__STRICT_ANSI__)
|
|---|
| 205 |
|
|---|
| 206 | #define HUGE HUGE_VAL
|
|---|
| 207 |
|
|---|
| 208 | #define atof CRTWRAP(atof)
|
|---|
| 209 | double atof (__const__ char *);
|
|---|
| 210 |
|
|---|
| 211 | #if !defined (_ABS) /* see also stdlib.h */
|
|---|
| 212 | #define _ABS
|
|---|
| 213 | #if !defined (__GNUC__) || __GNUC__ >= 2
|
|---|
| 214 |
|
|---|
| 215 | #define abs CRTWRAP(abs)
|
|---|
| 216 | #define labs CRTWRAP(labs)
|
|---|
| 217 |
|
|---|
| 218 | extern int abs (int);
|
|---|
| 219 | extern long labs (long);
|
|---|
| 220 | #else
|
|---|
| 221 | extern __inline__ int abs (int _n) { return (_n < 0 ? -_n : _n); }
|
|---|
| 222 | extern __inline__ long labs (long _n) { return (_n < 0 ? -_n : _n); }
|
|---|
| 223 | #endif
|
|---|
| 224 | #endif
|
|---|
| 225 |
|
|---|
| 226 | #endif
|
|---|
| 227 |
|
|---|
| 228 |
|
|---|
| 229 | #if !defined (__STRICT_ANSI__) || defined (_WITH_UNDERSCORE)
|
|---|
| 230 |
|
|---|
| 231 | #define _HUGE_VALF 1e9999F
|
|---|
| 232 | #define _HUGE_VALL 1e9999L
|
|---|
| 233 | #define _INFINITY 1e9999 /* TODO: float_t */
|
|---|
| 234 | #define _NAN (0.0/0.0) /* TODO: Exceptions, float_t */
|
|---|
| 235 |
|
|---|
| 236 | #define _LHUGE_VAL _HUGE_VALL
|
|---|
| 237 | #define _LHUGE _HUGE_VALL
|
|---|
| 238 |
|
|---|
| 239 | #define _copysignf CRTWRAP(_copysignf)
|
|---|
| 240 | #define _copysign CRTWRAP(_copysign)
|
|---|
| 241 | #define _copysignl CRTWRAP(_copysignl)
|
|---|
| 242 |
|
|---|
| 243 | float _copysignf (float, float);
|
|---|
| 244 | double _copysign (double, double);
|
|---|
| 245 | long double _copysignl (long double, long double);
|
|---|
| 246 |
|
|---|
| 247 | #define _nextafterf CRTWRAP(_nextafterf)
|
|---|
| 248 | #define _nextafter CRTWRAP(_nextafter)
|
|---|
| 249 | #define _nextafterl CRTWRAP(_nextafterl)
|
|---|
| 250 |
|
|---|
| 251 | float _nextafterf (float, float);
|
|---|
| 252 | double _nextafter (double, double);
|
|---|
| 253 | long double _nextafterl (long double, long double);
|
|---|
| 254 |
|
|---|
| 255 | #define _acosl CRTWRAP(_acosl)
|
|---|
| 256 | #define _asinl CRTWRAP(_asinl)
|
|---|
| 257 | #define _atanl CRTWRAP(_atanl)
|
|---|
| 258 | #define _atan2l CRTWRAP(_atan2l)
|
|---|
| 259 | #define _atofl CRTWRAP(_atofl)
|
|---|
| 260 | #define _cbrtl CRTWRAP(_cbrtl)
|
|---|
| 261 | #define _ceill CRTWRAP(_ceill)
|
|---|
| 262 | #define _cosl CRTWRAP(_cosl)
|
|---|
| 263 | #define _coshl CRTWRAP(_coshl)
|
|---|
| 264 | #define _hypotl CRTWRAP(_hypotl)
|
|---|
| 265 | #define _expl CRTWRAP(_expl)
|
|---|
| 266 | #define _fabsl CRTWRAP(_fabsl)
|
|---|
| 267 | #define _floorl CRTWRAP(_floorl)
|
|---|
| 268 | #define _fmodl CRTWRAP(_fmodl)
|
|---|
| 269 | #define _frexpl CRTWRAP(_frexpl)
|
|---|
| 270 | #define _ldexpl CRTWRAP(_ldexpl)
|
|---|
| 271 | #define _logl CRTWRAP(_logl)
|
|---|
| 272 | #define _log10l CRTWRAP(_log10l)
|
|---|
| 273 | #define _modfl CRTWRAP(_modfl)
|
|---|
| 274 | #define _powl CRTWRAP(_powl)
|
|---|
| 275 | #define _rintl CRTWRAP(_rintl)
|
|---|
| 276 | #define _sinl CRTWRAP(_sinl)
|
|---|
| 277 | #define _sinhl CRTWRAP(_sinhl)
|
|---|
| 278 | #define _sqrtl CRTWRAP(_sqrtl)
|
|---|
| 279 | #define _tanl CRTWRAP(_tanl)
|
|---|
| 280 | #define _tanhl CRTWRAP(_tanhl)
|
|---|
| 281 | #define _truncl CRTWRAP(_truncl)
|
|---|
| 282 |
|
|---|
| 283 | long double _acosl (long double);
|
|---|
| 284 | long double _asinl (long double);
|
|---|
| 285 | long double _atanl (long double);
|
|---|
| 286 | long double _atan2l (long double, long double);
|
|---|
| 287 | long double _atofl (__const__ char *);
|
|---|
| 288 | long double _cbrtl (long double);
|
|---|
| 289 | long double _ceill (long double);
|
|---|
| 290 | long double _cosl (long double);
|
|---|
| 291 | long double _coshl (long double);
|
|---|
| 292 | long double _hypotl (long double, long double);
|
|---|
| 293 | long double _expl (long double);
|
|---|
| 294 | long double _fabsl (long double);
|
|---|
| 295 | long double _floorl (long double);
|
|---|
| 296 | long double _fmodl (long double, long double);
|
|---|
| 297 | long double _frexpl (long double, int *);
|
|---|
| 298 | long double _ldexpl (long double, int);
|
|---|
| 299 | long double _logl (long double);
|
|---|
| 300 | long double _log10l (long double);
|
|---|
| 301 | long double _modfl (long double, long double *);
|
|---|
| 302 | long double _powl (long double, long double);
|
|---|
| 303 | long double _rintl (long double);
|
|---|
| 304 | long double _sinl (long double);
|
|---|
| 305 | long double _sinhl (long double);
|
|---|
| 306 | long double _sqrtl (long double);
|
|---|
| 307 | long double _tanl (long double);
|
|---|
| 308 | long double _tanhl (long double);
|
|---|
| 309 | long double _truncl (long double);
|
|---|
| 310 |
|
|---|
| 311 | /* Emx Extended Math - No prefixes */
|
|---|
| 312 | double y0(double);
|
|---|
| 313 | double y1(double);
|
|---|
| 314 | double yn(int,double);
|
|---|
| 315 |
|
|---|
| 316 | #endif
|
|---|
| 317 |
|
|---|
| 318 |
|
|---|
| 319 | #if defined (__cplusplus)
|
|---|
| 320 | }
|
|---|
| 321 | #endif
|
|---|
| 322 |
|
|---|
| 323 | #endif /* not _MATH_H */
|
|---|