math_private.h revision 334654
1/*
2 * ====================================================
3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
4 *
5 * Developed at SunPro, a Sun Microsystems, Inc. business.
6 * Permission to use, copy, modify, and distribute this
7 * software is freely granted, provided that this notice
8 * is preserved.
9 * ====================================================
10 */
11
12/*
13 * from: @(#)fdlibm.h 5.1 93/09/24
14 * $FreeBSD: stable/11/lib/msun/src/math_private.h 334654 2018-06-05 13:46:18Z kib $
15 */
16
17#ifndef _MATH_PRIVATE_H_
18#define	_MATH_PRIVATE_H_
19
20#include <sys/types.h>
21#include <machine/endian.h>
22
23/*
24 * The original fdlibm code used statements like:
25 *	n0 = ((*(int*)&one)>>29)^1;		* index of high word *
26 *	ix0 = *(n0+(int*)&x);			* high word of x *
27 *	ix1 = *((1-n0)+(int*)&x);		* low word of x *
28 * to dig two 32 bit words out of the 64 bit IEEE floating point
29 * value.  That is non-ANSI, and, moreover, the gcc instruction
30 * scheduler gets it wrong.  We instead use the following macros.
31 * Unlike the original code, we determine the endianness at compile
32 * time, not at run time; I don't see much benefit to selecting
33 * endianness at run time.
34 */
35
36/*
37 * A union which permits us to convert between a double and two 32 bit
38 * ints.
39 */
40
41#ifdef __arm__
42#if defined(__VFP_FP__) || defined(__ARM_EABI__)
43#define	IEEE_WORD_ORDER	BYTE_ORDER
44#else
45#define	IEEE_WORD_ORDER	BIG_ENDIAN
46#endif
47#else /* __arm__ */
48#define	IEEE_WORD_ORDER	BYTE_ORDER
49#endif
50
51#if IEEE_WORD_ORDER == BIG_ENDIAN
52
53typedef union
54{
55  double value;
56  struct
57  {
58    u_int32_t msw;
59    u_int32_t lsw;
60  } parts;
61  struct
62  {
63    u_int64_t w;
64  } xparts;
65} ieee_double_shape_type;
66
67#endif
68
69#if IEEE_WORD_ORDER == LITTLE_ENDIAN
70
71typedef union
72{
73  double value;
74  struct
75  {
76    u_int32_t lsw;
77    u_int32_t msw;
78  } parts;
79  struct
80  {
81    u_int64_t w;
82  } xparts;
83} ieee_double_shape_type;
84
85#endif
86
87/* Get two 32 bit ints from a double.  */
88
89#define EXTRACT_WORDS(ix0,ix1,d)				\
90do {								\
91  ieee_double_shape_type ew_u;					\
92  ew_u.value = (d);						\
93  (ix0) = ew_u.parts.msw;					\
94  (ix1) = ew_u.parts.lsw;					\
95} while (0)
96
97/* Get a 64-bit int from a double. */
98#define EXTRACT_WORD64(ix,d)					\
99do {								\
100  ieee_double_shape_type ew_u;					\
101  ew_u.value = (d);						\
102  (ix) = ew_u.xparts.w;						\
103} while (0)
104
105/* Get the more significant 32 bit int from a double.  */
106
107#define GET_HIGH_WORD(i,d)					\
108do {								\
109  ieee_double_shape_type gh_u;					\
110  gh_u.value = (d);						\
111  (i) = gh_u.parts.msw;						\
112} while (0)
113
114/* Get the less significant 32 bit int from a double.  */
115
116#define GET_LOW_WORD(i,d)					\
117do {								\
118  ieee_double_shape_type gl_u;					\
119  gl_u.value = (d);						\
120  (i) = gl_u.parts.lsw;						\
121} while (0)
122
123/* Set a double from two 32 bit ints.  */
124
125#define INSERT_WORDS(d,ix0,ix1)					\
126do {								\
127  ieee_double_shape_type iw_u;					\
128  iw_u.parts.msw = (ix0);					\
129  iw_u.parts.lsw = (ix1);					\
130  (d) = iw_u.value;						\
131} while (0)
132
133/* Set a double from a 64-bit int. */
134#define INSERT_WORD64(d,ix)					\
135do {								\
136  ieee_double_shape_type iw_u;					\
137  iw_u.xparts.w = (ix);						\
138  (d) = iw_u.value;						\
139} while (0)
140
141/* Set the more significant 32 bits of a double from an int.  */
142
143#define SET_HIGH_WORD(d,v)					\
144do {								\
145  ieee_double_shape_type sh_u;					\
146  sh_u.value = (d);						\
147  sh_u.parts.msw = (v);						\
148  (d) = sh_u.value;						\
149} while (0)
150
151/* Set the less significant 32 bits of a double from an int.  */
152
153#define SET_LOW_WORD(d,v)					\
154do {								\
155  ieee_double_shape_type sl_u;					\
156  sl_u.value = (d);						\
157  sl_u.parts.lsw = (v);						\
158  (d) = sl_u.value;						\
159} while (0)
160
161/*
162 * A union which permits us to convert between a float and a 32 bit
163 * int.
164 */
165
166typedef union
167{
168  float value;
169  /* FIXME: Assumes 32 bit int.  */
170  unsigned int word;
171} ieee_float_shape_type;
172
173/* Get a 32 bit int from a float.  */
174
175#define GET_FLOAT_WORD(i,d)					\
176do {								\
177  ieee_float_shape_type gf_u;					\
178  gf_u.value = (d);						\
179  (i) = gf_u.word;						\
180} while (0)
181
182/* Set a float from a 32 bit int.  */
183
184#define SET_FLOAT_WORD(d,i)					\
185do {								\
186  ieee_float_shape_type sf_u;					\
187  sf_u.word = (i);						\
188  (d) = sf_u.value;						\
189} while (0)
190
191/*
192 * Get expsign and mantissa as 16 bit and 64 bit ints from an 80 bit long
193 * double.
194 */
195
196#define	EXTRACT_LDBL80_WORDS(ix0,ix1,d)				\
197do {								\
198  union IEEEl2bits ew_u;					\
199  ew_u.e = (d);							\
200  (ix0) = ew_u.xbits.expsign;					\
201  (ix1) = ew_u.xbits.man;					\
202} while (0)
203
204/*
205 * Get expsign and mantissa as one 16 bit and two 64 bit ints from a 128 bit
206 * long double.
207 */
208
209#define	EXTRACT_LDBL128_WORDS(ix0,ix1,ix2,d)			\
210do {								\
211  union IEEEl2bits ew_u;					\
212  ew_u.e = (d);							\
213  (ix0) = ew_u.xbits.expsign;					\
214  (ix1) = ew_u.xbits.manh;					\
215  (ix2) = ew_u.xbits.manl;					\
216} while (0)
217
218/* Get expsign as a 16 bit int from a long double.  */
219
220#define	GET_LDBL_EXPSIGN(i,d)					\
221do {								\
222  union IEEEl2bits ge_u;					\
223  ge_u.e = (d);							\
224  (i) = ge_u.xbits.expsign;					\
225} while (0)
226
227/*
228 * Set an 80 bit long double from a 16 bit int expsign and a 64 bit int
229 * mantissa.
230 */
231
232#define	INSERT_LDBL80_WORDS(d,ix0,ix1)				\
233do {								\
234  union IEEEl2bits iw_u;					\
235  iw_u.xbits.expsign = (ix0);					\
236  iw_u.xbits.man = (ix1);					\
237  (d) = iw_u.e;							\
238} while (0)
239
240/*
241 * Set a 128 bit long double from a 16 bit int expsign and two 64 bit ints
242 * comprising the mantissa.
243 */
244
245#define	INSERT_LDBL128_WORDS(d,ix0,ix1,ix2)			\
246do {								\
247  union IEEEl2bits iw_u;					\
248  iw_u.xbits.expsign = (ix0);					\
249  iw_u.xbits.manh = (ix1);					\
250  iw_u.xbits.manl = (ix2);					\
251  (d) = iw_u.e;							\
252} while (0)
253
254/* Set expsign of a long double from a 16 bit int.  */
255
256#define	SET_LDBL_EXPSIGN(d,v)					\
257do {								\
258  union IEEEl2bits se_u;					\
259  se_u.e = (d);							\
260  se_u.xbits.expsign = (v);					\
261  (d) = se_u.e;							\
262} while (0)
263
264#ifdef __i386__
265/* Long double constants are broken on i386. */
266#define	LD80C(m, ex, v) {						\
267	.xbits.man = __CONCAT(m, ULL),					\
268	.xbits.expsign = (0x3fff + (ex)) | ((v) < 0 ? 0x8000 : 0),	\
269}
270#else
271/* The above works on non-i386 too, but we use this to check v. */
272#define	LD80C(m, ex, v)	{ .e = (v), }
273#endif
274
275#ifdef FLT_EVAL_METHOD
276/*
277 * Attempt to get strict C99 semantics for assignment with non-C99 compilers.
278 */
279#if FLT_EVAL_METHOD == 0 || __GNUC__ == 0
280#define	STRICT_ASSIGN(type, lval, rval)	((lval) = (rval))
281#else
282#define	STRICT_ASSIGN(type, lval, rval) do {	\
283	volatile type __lval;			\
284						\
285	if (sizeof(type) >= sizeof(long double))	\
286		(lval) = (rval);		\
287	else {					\
288		__lval = (rval);		\
289		(lval) = __lval;		\
290	}					\
291} while (0)
292#endif
293#endif /* FLT_EVAL_METHOD */
294
295/* Support switching the mode to FP_PE if necessary. */
296#if defined(__i386__) && !defined(NO_FPSETPREC)
297#define	ENTERI() ENTERIT(long double)
298#define	ENTERIT(returntype)			\
299	returntype __retval;			\
300	fp_prec_t __oprec;			\
301						\
302	if ((__oprec = fpgetprec()) != FP_PE)	\
303		fpsetprec(FP_PE)
304#define	RETURNI(x) do {				\
305	__retval = (x);				\
306	if (__oprec != FP_PE)			\
307		fpsetprec(__oprec);		\
308	RETURNF(__retval);			\
309} while (0)
310#define	ENTERV()				\
311	fp_prec_t __oprec;			\
312						\
313	if ((__oprec = fpgetprec()) != FP_PE)	\
314		fpsetprec(FP_PE)
315#define	RETURNV() do {				\
316	if (__oprec != FP_PE)			\
317		fpsetprec(__oprec);		\
318	return;			\
319} while (0)
320#else
321#define	ENTERI()
322#define	ENTERIT(x)
323#define	RETURNI(x)	RETURNF(x)
324#define	ENTERV()
325#define	RETURNV()	return
326#endif
327
328/* Default return statement if hack*_t() is not used. */
329#define      RETURNF(v)      return (v)
330
331/*
332 * 2sum gives the same result as 2sumF without requiring |a| >= |b| or
333 * a == 0, but is slower.
334 */
335#define	_2sum(a, b) do {	\
336	__typeof(a) __s, __w;	\
337				\
338	__w = (a) + (b);	\
339	__s = __w - (a);	\
340	(b) = ((a) - (__w - __s)) + ((b) - __s); \
341	(a) = __w;		\
342} while (0)
343
344/*
345 * 2sumF algorithm.
346 *
347 * "Normalize" the terms in the infinite-precision expression a + b for
348 * the sum of 2 floating point values so that b is as small as possible
349 * relative to 'a'.  (The resulting 'a' is the value of the expression in
350 * the same precision as 'a' and the resulting b is the rounding error.)
351 * |a| must be >= |b| or 0, b's type must be no larger than 'a's type, and
352 * exponent overflow or underflow must not occur.  This uses a Theorem of
353 * Dekker (1971).  See Knuth (1981) 4.2.2 Theorem C.  The name "TwoSum"
354 * is apparently due to Skewchuk (1997).
355 *
356 * For this to always work, assignment of a + b to 'a' must not retain any
357 * extra precision in a + b.  This is required by C standards but broken
358 * in many compilers.  The brokenness cannot be worked around using
359 * STRICT_ASSIGN() like we do elsewhere, since the efficiency of this
360 * algorithm would be destroyed by non-null strict assignments.  (The
361 * compilers are correct to be broken -- the efficiency of all floating
362 * point code calculations would be destroyed similarly if they forced the
363 * conversions.)
364 *
365 * Fortunately, a case that works well can usually be arranged by building
366 * any extra precision into the type of 'a' -- 'a' should have type float_t,
367 * double_t or long double.  b's type should be no larger than 'a's type.
368 * Callers should use these types with scopes as large as possible, to
369 * reduce their own extra-precision and efficiciency problems.  In
370 * particular, they shouldn't convert back and forth just to call here.
371 */
372#ifdef DEBUG
373#define	_2sumF(a, b) do {				\
374	__typeof(a) __w;				\
375	volatile __typeof(a) __ia, __ib, __r, __vw;	\
376							\
377	__ia = (a);					\
378	__ib = (b);					\
379	assert(__ia == 0 || fabsl(__ia) >= fabsl(__ib));	\
380							\
381	__w = (a) + (b);				\
382	(b) = ((a) - __w) + (b);			\
383	(a) = __w;					\
384							\
385	/* The next 2 assertions are weak if (a) is already long double. */ \
386	assert((long double)__ia + __ib == (long double)(a) + (b));	\
387	__vw = __ia + __ib;				\
388	__r = __ia - __vw;				\
389	__r += __ib;					\
390	assert(__vw == (a) && __r == (b));		\
391} while (0)
392#else /* !DEBUG */
393#define	_2sumF(a, b) do {	\
394	__typeof(a) __w;	\
395				\
396	__w = (a) + (b);	\
397	(b) = ((a) - __w) + (b); \
398	(a) = __w;		\
399} while (0)
400#endif /* DEBUG */
401
402/*
403 * Set x += c, where x is represented in extra precision as a + b.
404 * x must be sufficiently normalized and sufficiently larger than c,
405 * and the result is then sufficiently normalized.
406 *
407 * The details of ordering are that |a| must be >= |c| (so that (a, c)
408 * can be normalized without extra work to swap 'a' with c).  The details of
409 * the normalization are that b must be small relative to the normalized 'a'.
410 * Normalization of (a, c) makes the normalized c tiny relative to the
411 * normalized a, so b remains small relative to 'a' in the result.  However,
412 * b need not ever be tiny relative to 'a'.  For example, b might be about
413 * 2**20 times smaller than 'a' to give about 20 extra bits of precision.
414 * That is usually enough, and adding c (which by normalization is about
415 * 2**53 times smaller than a) cannot change b significantly.  However,
416 * cancellation of 'a' with c in normalization of (a, c) may reduce 'a'
417 * significantly relative to b.  The caller must ensure that significant
418 * cancellation doesn't occur, either by having c of the same sign as 'a',
419 * or by having |c| a few percent smaller than |a|.  Pre-normalization of
420 * (a, b) may help.
421 *
422 * This is is a variant of an algorithm of Kahan (see Knuth (1981) 4.2.2
423 * exercise 19).  We gain considerable efficiency by requiring the terms to
424 * be sufficiently normalized and sufficiently increasing.
425 */
426#define	_3sumF(a, b, c) do {	\
427	__typeof(a) __tmp;	\
428				\
429	__tmp = (c);		\
430	_2sumF(__tmp, (a));	\
431	(b) += (a);		\
432	(a) = __tmp;		\
433} while (0)
434
435/*
436 * Common routine to process the arguments to nan(), nanf(), and nanl().
437 */
438void _scan_nan(uint32_t *__words, int __num_words, const char *__s);
439
440#ifdef _COMPLEX_H
441
442/*
443 * C99 specifies that complex numbers have the same representation as
444 * an array of two elements, where the first element is the real part
445 * and the second element is the imaginary part.
446 */
447typedef union {
448	float complex f;
449	float a[2];
450} float_complex;
451typedef union {
452	double complex f;
453	double a[2];
454} double_complex;
455typedef union {
456	long double complex f;
457	long double a[2];
458} long_double_complex;
459#define	REALPART(z)	((z).a[0])
460#define	IMAGPART(z)	((z).a[1])
461
462/*
463 * Inline functions that can be used to construct complex values.
464 *
465 * The C99 standard intends x+I*y to be used for this, but x+I*y is
466 * currently unusable in general since gcc introduces many overflow,
467 * underflow, sign and efficiency bugs by rewriting I*y as
468 * (0.0+I)*(y+0.0*I) and laboriously computing the full complex product.
469 * In particular, I*Inf is corrupted to NaN+I*Inf, and I*-0 is corrupted
470 * to -0.0+I*0.0.
471 *
472 * The C11 standard introduced the macros CMPLX(), CMPLXF() and CMPLXL()
473 * to construct complex values.  Compilers that conform to the C99
474 * standard require the following functions to avoid the above issues.
475 */
476
477#ifndef CMPLXF
478static __inline float complex
479CMPLXF(float x, float y)
480{
481	float_complex z;
482
483	REALPART(z) = x;
484	IMAGPART(z) = y;
485	return (z.f);
486}
487#endif
488
489#ifndef CMPLX
490static __inline double complex
491CMPLX(double x, double y)
492{
493	double_complex z;
494
495	REALPART(z) = x;
496	IMAGPART(z) = y;
497	return (z.f);
498}
499#endif
500
501#ifndef CMPLXL
502static __inline long double complex
503CMPLXL(long double x, long double y)
504{
505	long_double_complex z;
506
507	REALPART(z) = x;
508	IMAGPART(z) = y;
509	return (z.f);
510}
511#endif
512
513#endif /* _COMPLEX_H */
514
515#ifdef __GNUCLIKE_ASM
516
517/* Asm versions of some functions. */
518
519#ifdef __amd64__
520static __inline int
521irint(double x)
522{
523	int n;
524
525	asm("cvtsd2si %1,%0" : "=r" (n) : "x" (x));
526	return (n);
527}
528#define	HAVE_EFFICIENT_IRINT
529#endif
530
531#ifdef __i386__
532static __inline int
533irint(double x)
534{
535	int n;
536
537	asm("fistl %0" : "=m" (n) : "t" (x));
538	return (n);
539}
540#define	HAVE_EFFICIENT_IRINT
541#endif
542
543#if defined(__amd64__) || defined(__i386__)
544static __inline int
545irintl(long double x)
546{
547	int n;
548
549	asm("fistl %0" : "=m" (n) : "t" (x));
550	return (n);
551}
552#define	HAVE_EFFICIENT_IRINTL
553#endif
554
555#endif /* __GNUCLIKE_ASM */
556
557#ifdef DEBUG
558#if defined(__amd64__) || defined(__i386__)
559#define	breakpoint()	asm("int $3")
560#else
561#include <signal.h>
562
563#define	breakpoint()	raise(SIGTRAP)
564#endif
565#endif
566
567/* Write a pari script to test things externally. */
568#ifdef DOPRINT
569#include <stdio.h>
570
571#ifndef DOPRINT_SWIZZLE
572#define	DOPRINT_SWIZZLE		0
573#endif
574
575#ifdef DOPRINT_LD80
576
577#define	DOPRINT_START(xp) do {						\
578	uint64_t __lx;							\
579	uint16_t __hx;							\
580									\
581	/* Hack to give more-problematic args. */			\
582	EXTRACT_LDBL80_WORDS(__hx, __lx, *xp);				\
583	__lx ^= DOPRINT_SWIZZLE;					\
584	INSERT_LDBL80_WORDS(*xp, __hx, __lx);				\
585	printf("x = %.21Lg; ", (long double)*xp);			\
586} while (0)
587#define	DOPRINT_END1(v)							\
588	printf("y = %.21Lg; z = 0; show(x, y, z);\n", (long double)(v))
589#define	DOPRINT_END2(hi, lo)						\
590	printf("y = %.21Lg; z = %.21Lg; show(x, y, z);\n",		\
591	    (long double)(hi), (long double)(lo))
592
593#elif defined(DOPRINT_D64)
594
595#define	DOPRINT_START(xp) do {						\
596	uint32_t __hx, __lx;						\
597									\
598	EXTRACT_WORDS(__hx, __lx, *xp);					\
599	__lx ^= DOPRINT_SWIZZLE;					\
600	INSERT_WORDS(*xp, __hx, __lx);					\
601	printf("x = %.21Lg; ", (long double)*xp);			\
602} while (0)
603#define	DOPRINT_END1(v)							\
604	printf("y = %.21Lg; z = 0; show(x, y, z);\n", (long double)(v))
605#define	DOPRINT_END2(hi, lo)						\
606	printf("y = %.21Lg; z = %.21Lg; show(x, y, z);\n",		\
607	    (long double)(hi), (long double)(lo))
608
609#elif defined(DOPRINT_F32)
610
611#define	DOPRINT_START(xp) do {						\
612	uint32_t __hx;							\
613									\
614	GET_FLOAT_WORD(__hx, *xp);					\
615	__hx ^= DOPRINT_SWIZZLE;					\
616	SET_FLOAT_WORD(*xp, __hx);					\
617	printf("x = %.21Lg; ", (long double)*xp);			\
618} while (0)
619#define	DOPRINT_END1(v)							\
620	printf("y = %.21Lg; z = 0; show(x, y, z);\n", (long double)(v))
621#define	DOPRINT_END2(hi, lo)						\
622	printf("y = %.21Lg; z = %.21Lg; show(x, y, z);\n",		\
623	    (long double)(hi), (long double)(lo))
624
625#else /* !DOPRINT_LD80 && !DOPRINT_D64 (LD128 only) */
626
627#ifndef DOPRINT_SWIZZLE_HIGH
628#define	DOPRINT_SWIZZLE_HIGH	0
629#endif
630
631#define	DOPRINT_START(xp) do {						\
632	uint64_t __lx, __llx;						\
633	uint16_t __hx;							\
634									\
635	EXTRACT_LDBL128_WORDS(__hx, __lx, __llx, *xp);			\
636	__llx ^= DOPRINT_SWIZZLE;					\
637	__lx ^= DOPRINT_SWIZZLE_HIGH;					\
638	INSERT_LDBL128_WORDS(*xp, __hx, __lx, __llx);			\
639	printf("x = %.36Lg; ", (long double)*xp);					\
640} while (0)
641#define	DOPRINT_END1(v)							\
642	printf("y = %.36Lg; z = 0; show(x, y, z);\n", (long double)(v))
643#define	DOPRINT_END2(hi, lo)						\
644	printf("y = %.36Lg; z = %.36Lg; show(x, y, z);\n",		\
645	    (long double)(hi), (long double)(lo))
646
647#endif /* DOPRINT_LD80 */
648
649#else /* !DOPRINT */
650#define	DOPRINT_START(xp)
651#define	DOPRINT_END1(v)
652#define	DOPRINT_END2(hi, lo)
653#endif /* DOPRINT */
654
655#define	RETURNP(x) do {			\
656	DOPRINT_END1(x);		\
657	RETURNF(x);			\
658} while (0)
659#define	RETURNPI(x) do {		\
660	DOPRINT_END1(x);		\
661	RETURNI(x);			\
662} while (0)
663#define	RETURN2P(x, y) do {		\
664	DOPRINT_END2((x), (y));		\
665	RETURNF((x) + (y));		\
666} while (0)
667#define	RETURN2PI(x, y) do {		\
668	DOPRINT_END2((x), (y));		\
669	RETURNI((x) + (y));		\
670} while (0)
671#ifdef STRUCT_RETURN
672#define	RETURNSP(rp) do {		\
673	if (!(rp)->lo_set)		\
674		RETURNP((rp)->hi);	\
675	RETURN2P((rp)->hi, (rp)->lo);	\
676} while (0)
677#define	RETURNSPI(rp) do {		\
678	if (!(rp)->lo_set)		\
679		RETURNPI((rp)->hi);	\
680	RETURN2PI((rp)->hi, (rp)->lo);	\
681} while (0)
682#endif
683#define	SUM2P(x, y) ({			\
684	const __typeof (x) __x = (x);	\
685	const __typeof (y) __y = (y);	\
686					\
687	DOPRINT_END2(__x, __y);		\
688	__x + __y;			\
689})
690
691/*
692 * ieee style elementary functions
693 *
694 * We rename functions here to improve other sources' diffability
695 * against fdlibm.
696 */
697#define	__ieee754_sqrt	sqrt
698#define	__ieee754_acos	acos
699#define	__ieee754_acosh	acosh
700#define	__ieee754_log	log
701#define	__ieee754_log2	log2
702#define	__ieee754_atanh	atanh
703#define	__ieee754_asin	asin
704#define	__ieee754_atan2	atan2
705#define	__ieee754_exp	exp
706#define	__ieee754_cosh	cosh
707#define	__ieee754_fmod	fmod
708#define	__ieee754_pow	pow
709#define	__ieee754_lgamma lgamma
710#define	__ieee754_gamma	gamma
711#define	__ieee754_lgamma_r lgamma_r
712#define	__ieee754_gamma_r gamma_r
713#define	__ieee754_log10	log10
714#define	__ieee754_sinh	sinh
715#define	__ieee754_hypot	hypot
716#define	__ieee754_j0	j0
717#define	__ieee754_j1	j1
718#define	__ieee754_y0	y0
719#define	__ieee754_y1	y1
720#define	__ieee754_jn	jn
721#define	__ieee754_yn	yn
722#define	__ieee754_remainder remainder
723#define	__ieee754_scalb	scalb
724#define	__ieee754_sqrtf	sqrtf
725#define	__ieee754_acosf	acosf
726#define	__ieee754_acoshf acoshf
727#define	__ieee754_logf	logf
728#define	__ieee754_atanhf atanhf
729#define	__ieee754_asinf	asinf
730#define	__ieee754_atan2f atan2f
731#define	__ieee754_expf	expf
732#define	__ieee754_coshf	coshf
733#define	__ieee754_fmodf	fmodf
734#define	__ieee754_powf	powf
735#define	__ieee754_lgammaf lgammaf
736#define	__ieee754_gammaf gammaf
737#define	__ieee754_lgammaf_r lgammaf_r
738#define	__ieee754_gammaf_r gammaf_r
739#define	__ieee754_log10f log10f
740#define	__ieee754_log2f log2f
741#define	__ieee754_sinhf	sinhf
742#define	__ieee754_hypotf hypotf
743#define	__ieee754_j0f	j0f
744#define	__ieee754_j1f	j1f
745#define	__ieee754_y0f	y0f
746#define	__ieee754_y1f	y1f
747#define	__ieee754_jnf	jnf
748#define	__ieee754_ynf	ynf
749#define	__ieee754_remainderf remainderf
750#define	__ieee754_scalbf scalbf
751
752/* fdlibm kernel function */
753int	__kernel_rem_pio2(double*,double*,int,int,int);
754
755/* double precision kernel functions */
756#ifndef INLINE_REM_PIO2
757int	__ieee754_rem_pio2(double,double*);
758#endif
759double	__kernel_sin(double,double,int);
760double	__kernel_cos(double,double);
761double	__kernel_tan(double,double,int);
762double	__ldexp_exp(double,int);
763#ifdef _COMPLEX_H
764double complex __ldexp_cexp(double complex,int);
765#endif
766
767/* float precision kernel functions */
768#ifndef INLINE_REM_PIO2F
769int	__ieee754_rem_pio2f(float,double*);
770#endif
771#ifndef INLINE_KERNEL_SINDF
772float	__kernel_sindf(double);
773#endif
774#ifndef INLINE_KERNEL_COSDF
775float	__kernel_cosdf(double);
776#endif
777#ifndef INLINE_KERNEL_TANDF
778float	__kernel_tandf(double,int);
779#endif
780float	__ldexp_expf(float,int);
781#ifdef _COMPLEX_H
782float complex __ldexp_cexpf(float complex,int);
783#endif
784
785/* long double precision kernel functions */
786long double __kernel_sinl(long double, long double, int);
787long double __kernel_cosl(long double, long double);
788long double __kernel_tanl(long double, long double, int);
789
790#endif /* !_MATH_PRIVATE_H_ */
791