VLSI Solution Oy / MegaLib Documentation

math.h

Go to the documentation of this file.
00001 #ifndef _MATH_H_
00002 #define _MATH_H_
00003 
00004 __near double frexp(double value, __near int *eptr);
00005 __near double ldexp(double value, int exp);
00006 __near double fabs(double value);
00007 #define frexp __builtin_frexp
00008 #define ldexp __builtin_ldexp
00009 #define fabs  __builtin_fabs
00010 
00011 __near double _modf(double value, __near double *iptr);
00012 #define modf(v,p) _modf(v,p)
00013 #define _oldmodf(v,p) (*(p)=(long)(v),(v)-(double)(long)(v))
00014 __near double fmod(double x, double y);
00015 
00016 /* NOTE: Check what this really should be !!!*/
00017 #define HUGE_VAL      3.402823466385288598e38
00018 
00019 #define EDOM        33
00020 #define ERANGE      34
00021 
00022 __near double acos(double);
00023 __near double asin(double);
00024 __near double atan(double);
00025 __near double cos(double);
00026 __near double cosh(double);
00027 __near double exp(double);
00028 __near double log10(double);
00029 __near double log(double);
00030 __near double sin(double);
00031 __near double sinh(double);
00032 __near double sqrt(double);
00033 __near double tan(double);
00034 __near double tanh(double);
00035 
00036 __near double floor(double);
00037 __near double ceil(double);
00038 __near double pow(double, double);
00039 __near double atan2(double, double);
00040 
00041 __near auto double SqrtF(double); /* result with 16-bit precision */
00042 __near auto unsigned short SqrtI(register __c unsigned long x);
00043 
00044 __near auto double SqrtF32(double); /* result with 32-bit precision */
00045 __near auto unsigned long SqrtI32(register __c unsigned long x); /* 16.16 result */
00046 __near double ISqrt(double x); /* x^(-1/2) */
00047 __near unsigned short LongLog2(register __a long x);
00048 #ifdef __VSDSP__
00049 __near double log2(double x); /*about 480 cycles*/
00050 __near short logdb(register __b0 unsigned short x); /*returns approximate decibels, -96 for 0 and 1, about 45 cycles */
00051 #else
00052 #define log2(x) (log(x)/log(2.))
00053 #define logdb(x) (x ? (int)(log(x)/log(2.)*6.0)-96 : -96) /*not bit-exact!*/
00054 #endif
00055 
00056 #ifndef __VSDSP__
00057 #define MulSh24(a,b) ((long)((long long)(a) * (b) >> 24))
00058 #define MulSh20(a,b) ((long)((long long)(a) * (b) >> 20))
00059 #else
00060 /* These functions should be called in integer mode */
00061 auto long MulSh24(register __a long c, register __d long d);
00062 auto long MulSh20(register __a long c, register __d long d);
00063 #endif
00064 /* Prototypes for 16-bit divisions to get both division result (low word)
00065    and remainder (high word) in one call. */
00066 unsigned long _divide16unsigned(register __b0 unsigned short dividend, register __a0 unsigned short D);
00067 unsigned long _divide16signed(register __b0 unsigned short dividend, register __a0 unsigned short D);
00068 
00069 
00070 #endif /* _MATH_H_ */

All software copyright 2005-2006 VLSI Solution OY. Redistribution of this software is strictly forbidden.