Update.
[glibc.git] / sysdeps / generic / mathimpl.h
bloba2c963d28856a2bb4566112d4c7da03a9f592545
1 /* This part here added by roland@prep.ai.mit.edu for the GNU C library. */
3 #include <math.h> /* Done first so we can #undef. */
4 #include <endian.h>
5 #if __BYTE_ORDER == __LITTLE_ENDIAN
6 #undef national
7 #define national
8 #endif
10 #undef isinf
11 #define isinf __isinf
12 #undef isnan
13 #define isnan __isnan
14 #undef infnan
15 #define infnan __infnan
16 #undef copysign
17 #define copysign __copysign
18 #undef scalb
19 #define scalb __scalb
20 #undef drem
21 #define drem __drem
22 #undef logb
23 #define logb __logb
24 #undef __finite
25 #undef finite
26 #define finite __finite
27 #undef expm1
28 #define expm1 __expm1
31 * Copyright (c) 1988, 1993
32 * The Regents of the University of California. All rights reserved.
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions
36 * are met:
37 * 1. Redistributions of source code must retain the above copyright
38 * notice, this list of conditions and the following disclaimer.
39 * 2. Redistributions in binary form must reproduce the above copyright
40 * notice, this list of conditions and the following disclaimer in the
41 * documentation and/or other materials provided with the distribution.
42 * 3. All advertising materials mentioning features or use of this software
43 * must display the following acknowledgement:
44 * This product includes software developed by the University of
45 * California, Berkeley and its contributors.
46 * 4. Neither the name of the University nor the names of its contributors
47 * may be used to endorse or promote products derived from this software
48 * without specific prior written permission.
50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 * SUCH DAMAGE.
62 * @(#)mathimpl.h 8.1 (Berkeley) 6/4/93
65 #include <sys/cdefs.h>
66 #include <math.h>
68 #if defined(vax)||defined(tahoe)
70 /* Deal with different ways to concatenate in cpp */
71 # ifdef __STDC__
72 # define cat3(a,b,c) a ## b ## c
73 # else
74 # define cat3(a,b,c) a/**/b/**/c
75 # endif
77 /* Deal with vax/tahoe byte order issues */
78 # ifdef vax
79 # define cat3t(a,b,c) cat3(a,b,c)
80 # else
81 # define cat3t(a,b,c) cat3(a,c,b)
82 # endif
84 # define vccast(name) (*(const double *)(cat3(name,,x)))
87 * Define a constant to high precision on a Vax or Tahoe.
89 * Args are the name to define, the decimal floating point value,
90 * four 16-bit chunks of the float value in hex
91 * (because the vax and tahoe differ in float format!), the power
92 * of 2 of the hex-float exponent, and the hex-float mantissa.
93 * Most of these arguments are not used at compile time; they are
94 * used in a post-check to make sure the constants were compiled
95 * correctly.
97 * People who want to use the constant will have to do their own
98 * #define foo vccast(foo)
99 * since CPP cannot do this for them from inside another macro (sigh).
100 * We define "vccast" if this needs doing.
102 # define vc(name, value, x1,x2,x3,x4, bexp, xval) \
103 const static long cat3(name,,x)[] = {cat3t(0x,x1,x2), cat3t(0x,x3,x4)};
105 # define ic(name, value, bexp, xval) ;
107 #else /* vax or tahoe */
109 /* Hooray, we have an IEEE machine */
110 # undef vccast
111 # define vc(name, value, x1,x2,x3,x4, bexp, xval) ;
113 # define ic(name, value, bexp, xval) \
114 const static double name = value;
116 #endif /* defined(vax)||defined(tahoe) */
120 * Functions internal to the math package, yet not static.
122 extern double __exp__E();
123 extern double __log__L();
125 struct Double {double a, b;};
126 double __exp__D __P((double, double));
127 struct Double __log__D __P((double));