00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00032 #ifndef __FIXEDPOINT_H__
00033 #define __FIXEDPOINT_H__
00034
00035 #include <68332/types.h>
00036
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040
00041 #define INT_TO_FIXED(x) ((x) << 16)
00042 #define DOUBLE_TO_FIXED(x) ((long)((x) * 65536.0 + 0.5))
00043 #define FIXED_TO_INT(x) ((x) >> 16)
00044 #define FIXED_TO_DOUBLE(x) (((double)(x)) / 65536.0)
00045 #define ROUND_FIXED_TO_INT(x) (((x) + 0x8000) >> 16)
00046
00047 #define FIXED_ONE INT_TO_FIXED(1)
00048 #define FIXED_PIDIV4 51472L
00049 #define FIXED_PIDIV2 102944L
00050 #define FIXED_PI 205887L
00051 #define FIXED_2PI 411775L
00052 #define FIXED_E 178144L
00053 #define FIXED_LN2 45426L
00054 #define FIXED_SQRT2 92682L
00055
00056 #ifndef FLOAT_PI
00057 #define FLOAT_PI 3.141592654
00058 #endif
00059
00071 int32 fpmul(int32 x, int32 y);
00072
00084 int32 fpdiv(int32 x, int32 y);
00085
00095 int32 fpsqrt(int32 x);
00096
00107 int32 fpsin(int32 x);
00108
00119 int32 fpcos(int32 x);
00120
00133 int32 fptan(int32 x);
00134
00145 int32 fpatan(int32 x);
00146
00156 int32 fpexp(int32 x);
00157
00167 int32 fpln(int32 x);
00168
00169 #ifdef __cplusplus
00170 }
00171 #endif
00172
00173 #endif