1 /*
2  * Copyright (c) 1988 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)mathimpl.h	5.3 (Berkeley) 10/09/90
8  */
9 
10 #include <math.h>
11 
12 #ifdef __STDC__
13 #define const const
14 #else
15 #define const /**/
16 #endif
17 
18 #if defined(vax)||defined(tahoe)
19 
20 /* Deal with different ways to concatenate in cpp */
21 #  ifdef __STDC__
22 #    define	cat3(a,b,c) a ## b ## c
23 #  else
24 #    define	cat3(a,b,c) a/**/b/**/c
25 #  endif
26 
27 /* Deal with vax/tahoe byte order issues */
28 #  ifdef vax
29 #    define	cat3t(a,b,c) cat3(a,b,c)
30 #  else
31 #    define	cat3t(a,b,c) cat3(a,c,b)
32 #  endif
33 
34 #  define vccast(name) (*(const double *)(cat3(name,,x)))
35 
36    /*
37     * Define a constant to high precision on a Vax or Tahoe.
38     *
39     * Args are the name to define, the decimal floating point value,
40     * four 16-bit chunks of the float value in hex
41     * (because the vax and tahoe differ in float format!), the power
42     * of 2 of the hex-float exponent, and the hex-float mantissa.
43     * Most of these arguments are not used at compile time; they are
44     * used in a post-check to make sure the constants were compiled
45     * correctly.
46     *
47     * People who want to use the constant will have to do their own
48     *     #define foo vccast(foo)
49     * since CPP cannot do this for them from inside another macro (sigh).
50     * We define "vccast" if this needs doing.
51     */
52 #  define vc(name, value, x1,x2,x3,x4, bexp, xval) \
53 	const static long cat3(name,,x)[] = {cat3t(0x,x1,x2), cat3t(0x,x3,x4)};
54 
55 #  define ic(name, value, bexp, xval) ;
56 
57 #else	/* vax or tahoe */
58 
59    /* Hooray, we have an IEEE machine */
60 #  undef vccast
61 #  define vc(name, value, x1,x2,x3,x4, bexp, xval) ;
62 
63 #  define ic(name, value, bexp, xval) \
64 	const static double name = value;
65 
66 #endif	/* defined(vax)||defined(tahoe) */
67 
68 
69 /*
70  * Functions internal to the math package, yet not static.
71  */
72 extern double	exp__E();
73 extern double	log__L();
74 
75