Oh GACK! src-clean doesn't quite work that easily since cleandist rebuilds the
[unix-history] / gnu / lib / libg++ / g++-include / math.h
CommitLineData
32df4d03
PR
1// This may look like C code, but it is really -*- C++ -*-
2/*
3Copyright (C) 1988 Free Software Foundation
4 written by Doug Lea (dl@rocky.oswego.edu)
5
6This file is part of the GNU C++ Library. This library is free
7software; you can redistribute it and/or modify it under the terms of
8the GNU Library General Public License as published by the Free
9Software Foundation; either version 2 of the License, or (at your
10option) any later version. This library is distributed in the hope
11that it will be useful, but WITHOUT ANY WARRANTY; without even the
12implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13PURPOSE. See the GNU Library General Public License for more details.
14You should have received a copy of the GNU Library General Public
15License along with this library; if not, write to the Free Software
16Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
17*/
18
19
20#ifndef _math_h
21#ifdef __GNUG__
22#pragma interface
23#endif
24#define _math_h 1
25
26#if defined(hp300) && defined(__HAVE_FPU__)
27#define __HAVE_68881__ 1
28#endif
29
30#if defined(masscomp)
31#define __HAVE_68881__ 1
32#endif
33
34#ifdef __HAVE_68881__ /* MC68881/2 Floating-Point Coprocessor */
35extern "C" { /* fill in what we've left out */
36#include <math-68881.h>
37
38double acosh(double);
39double asinh(double);
40double cbrt(double);
41double copysign(double,double);
42double erf(double);
43double erfc(double);
44double finite(double);
45double gamma(double);
46double hypot(double,double);
47double infnan(int);
48int isinf(double);
49int isnan(double);
50double j0(double);
51double j1(double);
52double jn(int, double);
53double lgamma(double);
54double y0(double);
55double y1(double);
56double yn(int, double);
57
58double aint(double);
59double anint(double);
60int irint(double);
61int nint(double);
62}
63/* Please add inline asm code for other machines here! */
64#else
65extern "C" {
66
67#include <_G_config.h>
68
69double acos(double);
70double acosh(double);
71double asin(double);
72double asinh(double);
73double atan(double);
74double atan2(double, double);
75double atanh(double);
76double cbrt(double);
77double ceil(double);
78double copysign(double,double);
79double cos(double);
80double cosh(double);
81double drem(double,double);
82double erf(double);
83double erfc(double);
84double exp(double);
85double expm1(double);
86double fabs(double);
87int finite(double);
88double floor(double);
89double fmod(double, double);
90double frexp(double, int*);
91double gamma(double);
92double hypot(double,double);
93double infnan(int);
94#if !defined(sequent) && !defined(DGUX) &&!defined(sony) && !defined(masscomp) && !defined(hpux)
95/* see below */
96int isinf(double);
97int isnan(double);
98#endif
99double j0(double);
100double j1(double);
101double jn(int, double);
102double ldexp(double, int);
103double lgamma(double);
104double log(double);
105double log10(double);
106double log1p(double);
107double logb(double);
108double modf(double, double*);
109double pow(double, double);
110double rint(double);
111double scalb _G_ARGS((double, int));
112double sin(double);
113double sinh(double);
114double sqrt(double);
115double tan(double);
116double tanh(double);
117double y0(double);
118double y1(double);
119double yn(int, double);
120
121double aint(double);
122double anint(double);
123int irint(double);
124int nint(double);
125}
126
127#endif
128
129/* libg++ doesn't use this since it is not available on some systems */
130
131/* the following ifdef is just for compiling OOPS */
132
133#ifndef DONT_DECLARE_EXCEPTION
134struct libm_exception
135{
136 int type;
137 char* name;
138 double arg1, arg2, retval;
139};
140
141#define DOMAIN 1
142#define SING 2
143#define OVERFLOW 3
144#define UNDERFLOW 4
145#define TLOSS 5
146#define PLOSS 6
147
148extern "C" int matherr(libm_exception*);
149
150#endif
151
152#include <float.h>
153
154/* On some systems, HUGE ought to be MAXFLOAT or IEEE infinity */
155
156#ifndef HUGE
157#define HUGE DBL_MAX
158#endif
159#ifndef HUGE_VAL
160#define HUGE_VAL DBL_MAX
161#endif
162
163
164/* sequents don't supply these. The following should suffice */
165#if defined(sequent) || defined(DGUX) || defined(sony) || defined(masscomp) \
166|| defined(hpux)
167#include <float.h>
168static inline int isnan(double x) { return x != x; }
169static inline int isinf(double x) { return x > DBL_MAX || x < -DBL_MAX; }
170#endif
171
172/* These seem to be sun & sysV names of these constants */
173
174#ifndef M_E
175#define M_E 2.7182818284590452354
176#endif
177#ifndef M_LOG2E
178#define M_LOG2E 1.4426950408889634074
179#endif
180#ifndef M_LOG10E
181#define M_LOG10E 0.43429448190325182765
182#endif
183#ifndef M_LN2
184#define M_LN2 0.69314718055994530942
185#endif
186#ifndef M_LN10
187#define M_LN10 2.30258509299404568402
188#endif
189#ifndef M_PI
190#define M_PI 3.14159265358979323846
191#endif
192#ifndef M_PI_2
193#define M_PI_2 1.57079632679489661923
194#endif
195#ifndef M_1_PI
196#define M_1_PI 0.31830988618379067154
197#endif
198#ifndef M_PI_4
199#define M_PI_4 0.78539816339744830962
200#endif
201#ifndef M_2_PI
202#define M_2_PI 0.63661977236758134308
203#endif
204#ifndef M_2_SQRTPI
205#define M_2_SQRTPI 1.12837916709551257390
206#endif
207#ifndef M_SQRT2
208#define M_SQRT2 1.41421356237309504880
209#endif
210#ifndef M_SQRT1_2
211#define M_SQRT1_2 0.70710678118654752440
212#endif
213
214#ifndef PI // as in stroustrup
215#define PI M_PI
216#endif
217#ifndef PI2
218#define PI2 M_PI_2
219#endif
220
221#endif