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