Search
lxdream.org :: lxdream/test/include/math.h
lxdream 0.9.1
released Jun 29
Download Now
filename test/include/math.h
changeset 185:6755a04c447f
author nkeynes
date Tue Jul 11 01:35:27 2006 +0000 (15 years ago)
permissions -rw-r--r--
last change First commit of system test framework. 3 initial test cases (incomplete):
testide, testmath, and testta
file annotate diff log raw
nkeynes@185
     1
/* math.h -- Definitions for the math floating point package.  */
nkeynes@185
     2
nkeynes@185
     3
#ifndef  _MATH_H_
nkeynes@185
     4
#ifdef __cplusplus
nkeynes@185
     5
extern "C" {
nkeynes@185
     6
#endif
nkeynes@185
     7
#define  _MATH_H_
nkeynes@185
     8
nkeynes@185
     9
#include <sys/reent.h>
nkeynes@185
    10
#include <machine/ieeefp.h>
nkeynes@185
    11
#include "_ansi.h"
nkeynes@185
    12
nkeynes@185
    13
#ifndef HUGE_VAL
nkeynes@185
    14
nkeynes@185
    15
/* Define HUGE_VAL as infinity, unless HUGE_VAL is already defined
nkeynes@185
    16
   (which might have been done by something like math-68881.h).  */
nkeynes@185
    17
nkeynes@185
    18
union __dmath
nkeynes@185
    19
{
nkeynes@185
    20
  __uint32_t i[2];
nkeynes@185
    21
  double d;
nkeynes@185
    22
};
nkeynes@185
    23
nkeynes@185
    24
extern const union __dmath __infinity;
nkeynes@185
    25
nkeynes@185
    26
#define HUGE_VAL (__infinity.d)
nkeynes@185
    27
nkeynes@185
    28
#endif /* ! defined (HUGE_VAL) */
nkeynes@185
    29
nkeynes@185
    30
/* Reentrant ANSI C functions.  */
nkeynes@185
    31
nkeynes@185
    32
#ifndef __math_68881
nkeynes@185
    33
extern double atan _PARAMS((double));
nkeynes@185
    34
extern double cos _PARAMS((double));
nkeynes@185
    35
extern double sin _PARAMS((double));
nkeynes@185
    36
extern double tan _PARAMS((double));
nkeynes@185
    37
extern double tanh _PARAMS((double));
nkeynes@185
    38
extern double frexp _PARAMS((double, int *));
nkeynes@185
    39
extern double modf _PARAMS((double, double *));
nkeynes@185
    40
extern double ceil _PARAMS((double));
nkeynes@185
    41
extern double fabs _PARAMS((double));
nkeynes@185
    42
extern double floor _PARAMS((double));
nkeynes@185
    43
#endif /* ! defined (__math_68881) */
nkeynes@185
    44
nkeynes@185
    45
/* Non reentrant ANSI C functions.  */
nkeynes@185
    46
nkeynes@185
    47
#ifndef _REENT_ONLY
nkeynes@185
    48
#ifndef __math_6881
nkeynes@185
    49
extern double acos _PARAMS((double));
nkeynes@185
    50
extern double asin _PARAMS((double));
nkeynes@185
    51
extern double atan2 _PARAMS((double, double));
nkeynes@185
    52
extern double cosh _PARAMS((double));
nkeynes@185
    53
extern double sinh _PARAMS((double));
nkeynes@185
    54
extern double exp _PARAMS((double));
nkeynes@185
    55
extern double ldexp _PARAMS((double, int));
nkeynes@185
    56
extern double log _PARAMS((double));
nkeynes@185
    57
extern double log10 _PARAMS((double));
nkeynes@185
    58
extern double pow _PARAMS((double, double));
nkeynes@185
    59
extern double sqrt _PARAMS((double));
nkeynes@185
    60
extern double fmod _PARAMS((double, double));
nkeynes@185
    61
#endif /* ! defined (__math_68881) */
nkeynes@185
    62
#endif /* ! defined (_REENT_ONLY) */
nkeynes@185
    63
nkeynes@185
    64
#ifndef __STRICT_ANSI__
nkeynes@185
    65
nkeynes@185
    66
/* Non ANSI double precision functions.  */
nkeynes@185
    67
nkeynes@185
    68
extern double infinity _PARAMS((void));
nkeynes@185
    69
extern double nan _PARAMS((void));
nkeynes@185
    70
extern int isnan _PARAMS((double));
nkeynes@185
    71
extern int isinf _PARAMS((double));
nkeynes@185
    72
extern int finite _PARAMS((double));
nkeynes@185
    73
extern double copysign _PARAMS((double, double));
nkeynes@185
    74
extern int ilogb _PARAMS((double));
nkeynes@185
    75
nkeynes@185
    76
extern double asinh _PARAMS((double));
nkeynes@185
    77
extern double cbrt _PARAMS((double));
nkeynes@185
    78
extern double nextafter _PARAMS((double, double));
nkeynes@185
    79
extern double rint _PARAMS((double));
nkeynes@185
    80
extern double scalbn _PARAMS((double, int));
nkeynes@185
    81
nkeynes@185
    82
#ifndef __math_68881
nkeynes@185
    83
extern double log1p _PARAMS((double));
nkeynes@185
    84
extern double expm1 _PARAMS((double));
nkeynes@185
    85
#endif /* ! defined (__math_68881) */
nkeynes@185
    86
nkeynes@185
    87
#ifndef _REENT_ONLY
nkeynes@185
    88
extern double acosh _PARAMS((double));
nkeynes@185
    89
extern double atanh _PARAMS((double));
nkeynes@185
    90
extern double remainder _PARAMS((double, double));
nkeynes@185
    91
extern double gamma _PARAMS((double));
nkeynes@185
    92
extern double gamma_r _PARAMS((double, int *));
nkeynes@185
    93
extern double lgamma _PARAMS((double));
nkeynes@185
    94
extern double lgamma_r _PARAMS((double, int *));
nkeynes@185
    95
extern double erf _PARAMS((double));
nkeynes@185
    96
extern double erfc _PARAMS((double));
nkeynes@185
    97
extern double y0 _PARAMS((double));
nkeynes@185
    98
extern double y1 _PARAMS((double));
nkeynes@185
    99
extern double yn _PARAMS((int, double));
nkeynes@185
   100
extern double j0 _PARAMS((double));
nkeynes@185
   101
extern double j1 _PARAMS((double));
nkeynes@185
   102
extern double jn _PARAMS((int, double));
nkeynes@185
   103
#define log2(x) (log (x) / M_LOG2_E)
nkeynes@185
   104
nkeynes@185
   105
#ifndef __math_68881
nkeynes@185
   106
extern double hypot _PARAMS((double, double));
nkeynes@185
   107
#endif
nkeynes@185
   108
nkeynes@185
   109
extern double cabs();
nkeynes@185
   110
extern double drem _PARAMS((double, double));
nkeynes@185
   111
nkeynes@185
   112
#endif /* ! defined (_REENT_ONLY) */
nkeynes@185
   113
nkeynes@185
   114
/* Single precision versions of ANSI functions.  */
nkeynes@185
   115
nkeynes@185
   116
extern float atanf _PARAMS((float));
nkeynes@185
   117
extern float cosf _PARAMS((float));
nkeynes@185
   118
extern float sinf _PARAMS((float));
nkeynes@185
   119
extern float tanf _PARAMS((float));
nkeynes@185
   120
extern float tanhf _PARAMS((float));
nkeynes@185
   121
extern float frexpf _PARAMS((float, int *));
nkeynes@185
   122
extern float modff _PARAMS((float, float *));
nkeynes@185
   123
extern float ceilf _PARAMS((float));
nkeynes@185
   124
extern float fabsf _PARAMS((float));
nkeynes@185
   125
extern float floorf _PARAMS((float));
nkeynes@185
   126
nkeynes@185
   127
#ifndef _REENT_ONLY
nkeynes@185
   128
extern float acosf _PARAMS((float));
nkeynes@185
   129
extern float asinf _PARAMS((float));
nkeynes@185
   130
extern float atan2f _PARAMS((float, float));
nkeynes@185
   131
extern float coshf _PARAMS((float));
nkeynes@185
   132
extern float sinhf _PARAMS((float));
nkeynes@185
   133
extern float expf _PARAMS((float));
nkeynes@185
   134
extern float ldexpf _PARAMS((float, int));
nkeynes@185
   135
extern float logf _PARAMS((float));
nkeynes@185
   136
extern float log10f _PARAMS((float));
nkeynes@185
   137
extern float powf _PARAMS((float, float));
nkeynes@185
   138
extern float sqrtf _PARAMS((float));
nkeynes@185
   139
extern float fmodf _PARAMS((float, float));
nkeynes@185
   140
#endif /* ! defined (_REENT_ONLY) */
nkeynes@185
   141
nkeynes@185
   142
/* Other single precision functions.  */
nkeynes@185
   143
nkeynes@185
   144
extern float infinityf _PARAMS((void));
nkeynes@185
   145
extern float nanf _PARAMS((void));
nkeynes@185
   146
extern int isnanf _PARAMS((float));
nkeynes@185
   147
extern int isinff _PARAMS((float));
nkeynes@185
   148
extern int finitef _PARAMS((float));
nkeynes@185
   149
extern float copysignf _PARAMS((float, float));
nkeynes@185
   150
extern int ilogbf _PARAMS((float));
nkeynes@185
   151
nkeynes@185
   152
extern float asinhf _PARAMS((float));
nkeynes@185
   153
extern float cbrtf _PARAMS((float));
nkeynes@185
   154
extern float nextafterf _PARAMS((float, float));
nkeynes@185
   155
extern float rintf _PARAMS((float));
nkeynes@185
   156
extern float scalbnf _PARAMS((float, int));
nkeynes@185
   157
extern float log1pf _PARAMS((float));
nkeynes@185
   158
extern float expm1f _PARAMS((float));
nkeynes@185
   159
nkeynes@185
   160
#ifndef _REENT_ONLY
nkeynes@185
   161
extern float acoshf _PARAMS((float));
nkeynes@185
   162
extern float atanhf _PARAMS((float));
nkeynes@185
   163
extern float remainderf _PARAMS((float, float));
nkeynes@185
   164
extern float gammaf _PARAMS((float));
nkeynes@185
   165
extern float gammaf_r _PARAMS((float, int *));
nkeynes@185
   166
extern float lgammaf _PARAMS((float));
nkeynes@185
   167
extern float lgammaf_r _PARAMS((float, int *));
nkeynes@185
   168
extern float erff _PARAMS((float));
nkeynes@185
   169
extern float erfcf _PARAMS((float));
nkeynes@185
   170
extern float y0f _PARAMS((float));
nkeynes@185
   171
extern float y1f _PARAMS((float));
nkeynes@185
   172
extern float ynf _PARAMS((int, float));
nkeynes@185
   173
extern float j0f _PARAMS((float));
nkeynes@185
   174
extern float j1f _PARAMS((float));
nkeynes@185
   175
extern float jnf _PARAMS((int, float));
nkeynes@185
   176
#define log2f(x) (logf (x) / (float) M_LOG2_E)
nkeynes@185
   177
extern float hypotf _PARAMS((float, float));
nkeynes@185
   178
nkeynes@185
   179
extern float cabsf();
nkeynes@185
   180
extern float dremf _PARAMS((float, float));
nkeynes@185
   181
nkeynes@185
   182
#endif /* ! defined (_REENT_ONLY) */
nkeynes@185
   183
nkeynes@185
   184
/* The gamma functions use a global variable, signgam.  */
nkeynes@185
   185
nkeynes@185
   186
extern int signgam;
nkeynes@185
   187
nkeynes@185
   188
/* The exception structure passed to the matherr routine.  */
nkeynes@185
   189
nkeynes@185
   190
#ifdef __cplusplus
nkeynes@185
   191
struct __exception 
nkeynes@185
   192
#else
nkeynes@185
   193
struct exception 
nkeynes@185
   194
#endif
nkeynes@185
   195
{
nkeynes@185
   196
  int type;
nkeynes@185
   197
  char *name;
nkeynes@185
   198
  double arg1;
nkeynes@185
   199
  double arg2;
nkeynes@185
   200
  double retval;
nkeynes@185
   201
  int err;
nkeynes@185
   202
};
nkeynes@185
   203
nkeynes@185
   204
#ifdef __cplusplus
nkeynes@185
   205
extern int matherr _PARAMS((struct __exception *e));
nkeynes@185
   206
#else
nkeynes@185
   207
extern int matherr _PARAMS((struct exception *e));
nkeynes@185
   208
#endif
nkeynes@185
   209
nkeynes@185
   210
/* Values for the type field of struct exception.  */
nkeynes@185
   211
nkeynes@185
   212
#define DOMAIN 1
nkeynes@185
   213
#define SING 2
nkeynes@185
   214
#define OVERFLOW 3
nkeynes@185
   215
#define UNDERFLOW 4
nkeynes@185
   216
#define TLOSS 5
nkeynes@185
   217
#define PLOSS 6
nkeynes@185
   218
nkeynes@185
   219
/* Useful constants.  */
nkeynes@185
   220
nkeynes@185
   221
#define M_E		2.7182818284590452354
nkeynes@185
   222
#define M_LOG2E		1.4426950408889634074
nkeynes@185
   223
#define M_LOG10E	0.43429448190325182765
nkeynes@185
   224
#define M_LN2		0.69314718055994530942
nkeynes@185
   225
#define M_LN10		2.30258509299404568402
nkeynes@185
   226
#define M_PI		3.14159265358979323846
nkeynes@185
   227
#define M_TWOPI         (M_PI * 2.0)
nkeynes@185
   228
#define M_PI_2		1.57079632679489661923
nkeynes@185
   229
#define M_PI_4		0.78539816339744830962
nkeynes@185
   230
#define M_3PI_4		2.3561944901923448370E0
nkeynes@185
   231
#define M_SQRTPI        1.77245385090551602792981
nkeynes@185
   232
#define M_1_PI		0.31830988618379067154
nkeynes@185
   233
#define M_2_PI		0.63661977236758134308
nkeynes@185
   234
#define M_2_SQRTPI	1.12837916709551257390
nkeynes@185
   235
#define M_SQRT2		1.41421356237309504880
nkeynes@185
   236
#define M_SQRT1_2	0.70710678118654752440
nkeynes@185
   237
#define M_LN2LO         1.9082149292705877000E-10
nkeynes@185
   238
#define M_LN2HI         6.9314718036912381649E-1
nkeynes@185
   239
#define M_SQRT3   	1.73205080756887719000
nkeynes@185
   240
#define M_IVLN10        0.43429448190325182765 /* 1 / log(10) */
nkeynes@185
   241
#define M_LOG2_E        0.693147180559945309417
nkeynes@185
   242
#define M_INVLN2        1.4426950408889633870E0  /* 1 / log(2) */
nkeynes@185
   243
nkeynes@185
   244
/* Global control over fdlibm error handling.  */
nkeynes@185
   245
nkeynes@185
   246
enum __fdlibm_version
nkeynes@185
   247
{
nkeynes@185
   248
  __fdlibm_ieee = -1,
nkeynes@185
   249
  __fdlibm_svid,
nkeynes@185
   250
  __fdlibm_xopen,
nkeynes@185
   251
  __fdlibm_posix
nkeynes@185
   252
};
nkeynes@185
   253
nkeynes@185
   254
#define _LIB_VERSION_TYPE enum __fdlibm_version
nkeynes@185
   255
#define _LIB_VERSION __fdlib_version
nkeynes@185
   256
nkeynes@185
   257
extern _CONST _LIB_VERSION_TYPE _LIB_VERSION;
nkeynes@185
   258
nkeynes@185
   259
#define _IEEE_  __fdlibm_ieee
nkeynes@185
   260
#define _SVID_  __fdlibm_svid
nkeynes@185
   261
#define _XOPEN_ __fdlibm_xopen
nkeynes@185
   262
#define _POSIX_ __fdlibm_posix
nkeynes@185
   263
nkeynes@185
   264
#endif /* ! defined (__STRICT_ANSI__) */
nkeynes@185
   265
nkeynes@185
   266
#ifdef __FAST_MATH__
nkeynes@185
   267
#include <machine/fastmath.h>
nkeynes@185
   268
#endif
nkeynes@185
   269
nkeynes@185
   270
#ifdef __cplusplus
nkeynes@185
   271
}
nkeynes@185
   272
#endif
nkeynes@185
   273
#endif /* _MATH_H_ */
.