/[projet1]/public/pc/tools/osdk/main/Osdk/_final_/include2/math.h
Defence Force logotype

Contents of /public/pc/tools/osdk/main/Osdk/_final_/include2/math.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1159 - (show annotations)
Sun Aug 10 18:31:35 2014 UTC (5 years, 5 months ago) by dbug
File MIME type: text/plain
File size: 1839 byte(s)


1 /* some useful constants */
2
3 #define M_E 2.7182818284590452354 /* e */
4 #define M_LOG2E 1.4426950408889634074 /* log 2e */
5 #define M_LOG10E 0.43429448190325182765 /* log 10e */
6 #define M_LN2 0.69314718055994530942 /* log e2 */
7 #define M_LN10 2.30258509299404568402 /* log e10 */
8 #define M_PI 3.14159265358979323846 /* pi */
9 #define M_PI_2 1.57079632679489661923 /* pi/2 */
10 #define M_PI_4 0.78539816339744830962 /* pi/4 */
11 #define M_1_PI 0.31830988618379067154 /* 1/pi */
12 #define M_2_PI 0.63661977236758134308 /* 2/pi */
13 #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
14 #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
15 #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
16
17 /* trigonometric functions */
18
19 double atn(double x);
20 double cos(double x);
21 double sin(double x);
22 double tan(double x);
23
24 /* logarithmic functions */
25
26 double exp(double x);
27 double log(double x);
28 double log10(double x);
29
30 /* power functions */
31
32 double pow(double x,double y); /* x to the power y */
33 double sqrt(double x);
34
35 /* extract integral and fractional parts : fractional part of x is return as
36 result while integral part is stored in the variable whose address is
37 given as second argument */
38
39 double modf(double x, double *iptr);
40
41 /* absolute value */
42
43 double fabs(double x);
44
45 /* compute a polynomial using Horner's scheme */
46 /* Note: this is not a standard call at all... but this can be used to
47 compute missing functions at machine code speed on the Oric */
48 /* coefficients must be stored starting with the highest degree, e.g:
49
50 double coef[]={ 1.0/120, 1.0/24, 1.0/6, 1.0/2, 1.0, 1.0 };
51 double r = horner( x, 5, coef);
52
53 will compute x^5/120 + x^4/24 + x^3/6 + x^2/2 + x + 1
54 */
55
56 double horner(double x, int degree, double coefficients[]);

  ViewVC Help
Powered by ViewVC 1.1.26