summaryrefslogtreecommitdiff
path: root/src/math/math_private.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-03-13 01:17:53 -0400
committerRich Felker <dalias@aerifal.cx>2012-03-13 01:17:53 -0400
commitb69f695acedd4ce2798ef9ea28d834ceccc789bd (patch)
treeeafd98b9b75160210f3295ac074d699f863d958e /src/math/math_private.h
parentd46cf2e14cc4df7cc75e77d7009fcb6df1f48a33 (diff)
downloadmusl-b69f695acedd4ce2798ef9ea28d834ceccc789bd.tar.gz
first commit of the new libm!
thanks to the hard work of Szabolcs Nagy (nsz), identifying the best (from correctness and license standpoint) implementations from freebsd and openbsd and cleaning them up! musl should now fully support c99 float and long double math functions, and has near-complete complex math support. tgmath should also work (fully on gcc-compatible compilers, and mostly on any c99 compiler). based largely on commit 0376d44a890fea261506f1fc63833e7a686dca19 from nsz's libm git repo, with some additions (dummy versions of a few missing long double complex functions, etc.) by me. various cleanups still need to be made, including re-adding (if they're correct) some asm functions that were dropped.
Diffstat (limited to 'src/math/math_private.h')
-rw-r--r--src/math/math_private.h143
1 files changed, 0 insertions, 143 deletions
diff --git a/src/math/math_private.h b/src/math/math_private.h
deleted file mode 100644
index 28a6a195..00000000
--- a/src/math/math_private.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#ifndef _MATH_PRIVATE_H_
-#define _MATH_PRIVATE_H_
-
-#include <inttypes.h>
-
-/*
- * The original fdlibm code used statements like:
- * n0 = ((*(int*)&one)>>29)^1; * index of high word *
- * ix0 = *(n0+(int*)&x); * high word of x *
- * ix1 = *((1-n0)+(int*)&x); * low word of x *
- * to dig two 32 bit words out of the 64 bit IEEE floating point
- * value. That is non-ANSI, and, moreover, the gcc instruction
- * scheduler gets it wrong. We instead use the following macros.
- * Unlike the original code, we determine the endianness at compile
- * time, not at run time; I don't see much benefit to selecting
- * endianness at run time.
- */
-
-/*
- * A union which permits us to convert between a double and two 32 bit
- * ints.
- */
-
-typedef union
-{
- double value;
- uint64_t words;
-} ieee_double_shape_type;
-
-/* Get two 32 bit ints from a double. */
-
-#define EXTRACT_WORDS(ix0,ix1,d) \
-do { \
- ieee_double_shape_type ew_u; \
- ew_u.value = (d); \
- (ix0) = ew_u.words >> 32; \
- (ix1) = (uint32_t)ew_u.words; \
-} while (0)
-
-/* Get the more significant 32 bit int from a double. */
-
-#define GET_HIGH_WORD(i,d) \
-do { \
- ieee_double_shape_type gh_u; \
- gh_u.value = (d); \
- (i) = gh_u.words >> 32; \
-} while (0)
-
-/* Get the less significant 32 bit int from a double. */
-
-#define GET_LOW_WORD(i,d) \
-do { \
- ieee_double_shape_type gl_u; \
- gl_u.value = (d); \
- (i) = (uint32_t)gl_u.words; \
-} while (0)
-
-/* Set a double from two 32 bit ints. */
-
-#define INSERT_WORDS(d,ix0,ix1) \
-do { \
- ieee_double_shape_type iw_u; \
- iw_u.words = ((uint64_t)(ix0) << 32) | (ix1); \
- (d) = iw_u.value; \
-} while (0)
-
-/* Set the more significant 32 bits of a double from an int. */
-
-#define SET_HIGH_WORD(d,v) \
-do { \
- ieee_double_shape_type sh_u; \
- sh_u.value = (d); \
- sh_u.words &= 0xffffffff; \
- sh_u.words |= ((uint64_t)(v) << 32); \
- (d) = sh_u.value; \
-} while (0)
-
-/* Set the less significant 32 bits of a double from an int. */
-
-#define SET_LOW_WORD(d,v) \
-do { \
- ieee_double_shape_type sl_u; \
- sl_u.value = (d); \
- sl_u.words &= 0xffffffff00000000ull; \
- sl_u.words |= (uint32_t)(v); \
- (d) = sl_u.value; \
-} while (0)
-
-/*
- * A union which permits us to convert between a float and a 32 bit
- * int.
- */
-
-typedef union
-{
- float value;
- uint32_t word;
-} ieee_float_shape_type;
-
-/* Get a 32 bit int from a float. */
-
-#define GET_FLOAT_WORD(i,d) \
-do { \
- ieee_float_shape_type gf_u; \
- gf_u.value = (d); \
- (i) = gf_u.word; \
-} while (0)
-
-/* Set a float from a 32 bit int. */
-
-#define SET_FLOAT_WORD(d,i) \
-do { \
- ieee_float_shape_type sf_u; \
- sf_u.word = (i); \
- (d) = sf_u.value; \
-} while (0)
-
-/* fdlibm kernel function */
-int __ieee754_rem_pio2(double,double*);
-double __kernel_sin(double,double,int);
-double __kernel_cos(double,double);
-double __kernel_tan(double,double,int);
-int __kernel_rem_pio2(double*,double*,int,int,int,const int*);
-
-/* float versions of fdlibm kernel functions */
-int __ieee754_rem_pio2f(float,float*);
-float __kernel_sinf(float,float,int);
-float __kernel_cosf(float,float);
-float __kernel_tanf(float,float,int);
-int __kernel_rem_pio2f(float*,float*,int,int,int,const int*);
-
-#endif /* !_MATH_PRIVATE_H_ */