| 1 | /* |
| 2 | * Copyright (c) 1985, 1990 The Regents of the University of California. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * 3. All advertising materials mentioning features or use of this software |
| 14 | * must display the following acknowledgement: |
| 15 | * This product includes software developed by the University of |
| 16 | * California, Berkeley and its contributors. |
| 17 | * 4. Neither the name of the University nor the names of its contributors |
| 18 | * may be used to endorse or promote products derived from this software |
| 19 | * without specific prior written permission. |
| 20 | * |
| 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 31 | * SUCH DAMAGE. |
| 32 | * |
| 33 | * @(#)math.h 5.8 (Berkeley) 4/2/91 |
| 34 | */ |
| 35 | |
| 36 | #ifndef _MATH_H_ |
| 37 | #define _MATH_H_ |
| 38 | |
| 39 | #if defined(vax) || defined(tahoe) /* DBL_MAX from float.h */ |
| 40 | #define HUGE_VAL 1.701411834604692294E+38 |
| 41 | #else |
| 42 | extern char __infinity[]; /* bytes for IEEE754 +Infinity */ |
| 43 | #define HUGE_VAL (*(double *) __infinity) |
| 44 | #endif |
| 45 | |
| 46 | #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) |
| 47 | #if defined(vax) || defined(tahoe) |
| 48 | /* |
| 49 | * HUGE for the VAX and Tahoe converts to the largest possible F-float value. |
| 50 | * This implies an understanding of the conversion behavior of atof(3). It |
| 51 | * was defined to be the largest float so that overflow didn't occur when it |
| 52 | * was assigned to a single precision number. HUGE_VAL is strongly preferred. |
| 53 | */ |
| 54 | #define HUGE 1.701411733192644270E+38 |
| 55 | #else |
| 56 | #define HUGE HUGE_VAL |
| 57 | #endif |
| 58 | #endif |
| 59 | |
| 60 | #define M_E 2.7182818284590452354 /* e */ |
| 61 | #define M_LOG2E 1.4426950408889634074 /* log 2e */ |
| 62 | #define M_LOG10E 0.43429448190325182765 /* log 10e */ |
| 63 | #define M_LN2 0.69314718055994530942 /* log e2 */ |
| 64 | #define M_LN10 2.30258509299404568402 /* log e10 */ |
| 65 | #define M_PI 3.14159265358979323846 /* pi */ |
| 66 | #define M_PI_2 1.57079632679489661923 /* pi/2 */ |
| 67 | #define M_PI_4 0.78539816339744830962 /* pi/4 */ |
| 68 | #define M_1_PI 0.31830988618379067154 /* 1/pi */ |
| 69 | #define M_2_PI 0.63661977236758134308 /* 2/pi */ |
| 70 | #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ |
| 71 | #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ |
| 72 | #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ |
| 73 | |
| 74 | #include <sys/cdefs.h> |
| 75 | |
| 76 | __BEGIN_DECLS |
| 77 | double acos __P((double)); |
| 78 | double asin __P((double)); |
| 79 | double atan __P((double)); |
| 80 | double atan2 __P((double, double)); |
| 81 | double ceil __P((double)); |
| 82 | double cos __P((double)); |
| 83 | double cosh __P((double)); |
| 84 | double exp __P((double)); |
| 85 | double fabs __P((double)); |
| 86 | double floor __P((double)); |
| 87 | double fmod __P((double, double)); |
| 88 | double frexp __P((double, int *)); |
| 89 | double ldexp __P((double, int)); |
| 90 | double log __P((double)); |
| 91 | double log10 __P((double)); |
| 92 | double modf __P((double, double *)); |
| 93 | double pow __P((double, double)); |
| 94 | double sin __P((double)); |
| 95 | double sinh __P((double)); |
| 96 | double sqrt __P((double)); |
| 97 | double tan __P((double)); |
| 98 | double tanh __P((double)); |
| 99 | |
| 100 | #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) |
| 101 | double acosh __P((double)); |
| 102 | double asinh __P((double)); |
| 103 | double atanh __P((double)); |
| 104 | double cabs(); /* we can't describe cabs()'s argument properly */ |
| 105 | double cbrt __P((double)); |
| 106 | double copysign __P((double, double)); |
| 107 | double drem __P((double, double)); |
| 108 | double erf __P((double)); |
| 109 | double erfc __P((double)); |
| 110 | double expm1 __P((double)); |
| 111 | int finite __P((double)); |
| 112 | double hypot __P((double, double)); |
| 113 | #if defined(vax) || defined(tahoe) |
| 114 | double infnan __P((int)); |
| 115 | #endif |
| 116 | int isinf __P((double)); |
| 117 | int isnan __P((double)); |
| 118 | double j0 __P((double)); |
| 119 | double j1 __P((double)); |
| 120 | double jn __P((int, double)); |
| 121 | double lgamma __P((double)); |
| 122 | double gamma __P((double)); |
| 123 | double log1p __P((double)); |
| 124 | double logb __P((double)); |
| 125 | double rint __P((double)); |
| 126 | double scalb __P((double, int)); |
| 127 | double y0 __P((double)); |
| 128 | double y1 __P((double)); |
| 129 | double yn __P((int, double)); |
| 130 | #endif |
| 131 | |
| 132 | __END_DECLS |
| 133 | |
| 134 | #endif /* _MATH_H_ */ |