1899
|
1 /* -----------------------------------------------------------------------------
|
|
2 * math.i
|
|
3 *
|
|
4 * SWIG library file for floating point operations.
|
|
5 * ----------------------------------------------------------------------------- */
|
|
6
|
|
7 %module math
|
|
8 %{
|
|
9 #include <math.h>
|
|
10 %}
|
|
11
|
|
12 extern double cos(double x);
|
|
13 /* Cosine of x */
|
|
14
|
|
15 extern double sin(double x);
|
|
16 /* Sine of x */
|
|
17
|
|
18 extern double tan(double x);
|
|
19 /* Tangent of x */
|
|
20
|
|
21 extern double acos(double x);
|
|
22 /* Inverse cosine in range [-PI/2,PI/2], x in [-1,1]. */
|
|
23
|
|
24 extern double asin(double x);
|
|
25 /* Inverse sine in range [0,PI], x in [-1,1]. */
|
|
26
|
|
27 extern double atan(double x);
|
|
28 /* Inverse tangent in range [-PI/2,PI/2]. */
|
|
29
|
|
30 extern double atan2(double y, double x);
|
|
31 /* Inverse tangent of y/x in range [-PI,PI]. */
|
|
32
|
|
33 extern double cosh(double x);
|
|
34 /* Hyperbolic cosine of x */
|
|
35
|
|
36 extern double sinh(double x);
|
|
37 /* Hyperbolic sine of x */
|
|
38
|
|
39 extern double tanh(double x);
|
|
40 /* Hyperbolic tangent of x */
|
|
41
|
|
42 extern double exp(double x);
|
|
43 /* Natural exponential function e^x */
|
|
44
|
|
45 extern double log(double x);
|
|
46 /* Natural logarithm ln(x), x > 0 */
|
|
47
|
|
48 extern double log10(double x);
|
|
49 /* Base 10 logarithm, x > 0 */
|
|
50
|
|
51 extern double pow(double x, double y);
|
|
52 /* Power function x^y. */
|
|
53
|
|
54 extern double sqrt(double x);
|
|
55 /* Square root. x >= 0 */
|
|
56
|
|
57 extern double fabs(double x);
|
|
58 /* Absolute value of x */
|
|
59
|
|
60 extern double ceil(double x);
|
|
61 /* Smallest integer not less than x, as a double */
|
|
62
|
|
63 extern double floor(double x);
|
|
64 /* Largest integer not greater than x, as a double */
|
|
65
|
|
66 extern double fmod(double x, double y);
|
|
67 /* Floating-point remainder of x/y, with the same sign as x. */
|
|
68
|
|
69 #define M_E 2.7182818284590452354
|
|
70 #define M_LOG2E 1.4426950408889634074
|
|
71 #define M_LOG10E 0.43429448190325182765
|
|
72 #define M_LN2 0.69314718055994530942
|
|
73 #define M_LN10 2.30258509299404568402
|
|
74 #define M_PI 3.14159265358979323846
|
|
75 #define M_PI_2 1.57079632679489661923
|
|
76 #define M_PI_4 0.78539816339744830962
|
|
77 #define M_1_PI 0.31830988618379067154
|
|
78 #define M_2_PI 0.63661977236758134308
|
|
79 #define M_2_SQRTPI 1.12837916709551257390
|
|
80 #define M_SQRT2 1.41421356237309504880
|
|
81 #define M_SQRT1_2 0.70710678118654752440
|
|
82
|