summaryrefslogtreecommitdiff
path: root/tool/headers/architecture
diff options
context:
space:
mode:
authorJay Freeman <saurik@saurik.com>2008-03-06 17:26:18 +0000
committerJay Freeman <saurik@saurik.com>2008-03-06 17:26:18 +0000
commit294906ee694d21bb40a5ddc71d1cdb6278455f83 (patch)
tree15d1c6482bc2fedbabbea5002290db240f84c779 /tool/headers/architecture
parent67d8a376ae087b3668b96f1affbab031827662cd (diff)
Committing all the headers I changed.
git-svn-id: http://svn.telesphoreo.org/trunk@161 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'tool/headers/architecture')
-rw-r--r--tool/headers/architecture/arm/fenv.h294
-rw-r--r--tool/headers/architecture/arm/math.h611
2 files changed, 905 insertions, 0 deletions
diff --git a/tool/headers/architecture/arm/fenv.h b/tool/headers/architecture/arm/fenv.h
new file mode 100644
index 000000000..0b8130ee0
--- /dev/null
+++ b/tool/headers/architecture/arm/fenv.h
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * The contents of this file constitute Original Code as defined in and
+ * are subject to the Apple Public Source License Version 1.1 (the
+ * "License"). You may not use this file except in compliance with the
+ * License. Please obtain a copy of the License at
+ * http://www.apple.com/publicsource and read it before using this file.
+ *
+ * This Original Code and all software distributed under the License are
+ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+/*******************************************************************************
+* *
+* File: fenv.h *
+* *
+* Contains: typedefs and prototypes for C99 floating point environment. *
+* *
+*******************************************************************************/
+
+#ifndef __FENV__
+#define __FENV__
+
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+#pragma GCC fenv
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ A collection of functions designed to provide access to the floating
+ point environment for numerical programming. It is compliant with
+ the floating-point requirements in C99.
+
+ Earlier versions of fenv.h were merely "modeled after" C9X. Many of the functions
+ that formerly returned ints now return void to be standard compliant.
+
+ Note: There are actually two physical floating point environments on x86. There
+ is the one described by the x87 floating point control and status words, which applies
+ primarily to calculations done with long double on MacOS X for Intel. There is the
+ MXCSR which applies primarily to calculations done with scalar float, scalar double
+ and SSE/SSE2/SSE3. The high level interface, which uses FE_ macros as int arguments
+ to configure the fexcep_t, returns and works with values that represents the logical
+ OR of these two sets of flags or masks. That is, if a flag or mask is set in either
+ environment, it will be set in fexcept_t when the state is read. Likewise, setting
+ the mask using a fexcep_t will set that mask on both environments. For this reason,
+ changing the value of the MXCSR state or floating point control/status word state on
+ your own will make the results of the functions declared in this header undefined.
+ See below for details about how and when. Exception: you may change the FZ, DAZ, DE
+ and DM bits in the MXCSR independent of this interface and retain defined behavior,
+ so long as you do not change the other bits. It is suggested that developers who wish
+ this level of control access the bits in the fenv_t directly. They are direct copies
+ of the hardware special purpose registers of similar name. Please consult appropriate
+ Intel documentation for the processor about the meaning of various bits in each register.
+
+ The file <fenv.h> declares many functions in support of numerical
+ programming. Programs that test flags or run under
+ non-default modes must do so under the effect of an enabling
+ "fenv_access" pragma.
+*/
+
+/********************************************************************************
+* *
+* fenv_t is a type for representing the entire floating-point *
+* environment in a single object. *
+* *
+* fexcept_t is a type for representing the floating-point *
+* exception flag state collectively. *
+* *
+********************************************************************************/
+typedef struct {
+ unsigned short __control; /* A direct copy of the floaing point control word */
+ unsigned short __status; /* A direct copy of the floaing point status word */
+ unsigned int __mxcsr; /* A direct copy of the MXCSR */
+ char __reserved[8]; /* Reserved for future expansion. */
+} fenv_t;
+
+typedef unsigned short fexcept_t;
+
+/* Definitions of floating-point exception macros */
+enum {
+ _FE_INEXACT = 0x0020,
+ _FE_DIVBYZERO = 0x0004,
+ _FE_UNDERFLOW = 0x0010,
+ _FE_OVERFLOW = 0x0008,
+ _FE_INVALID = 0x0001,
+ _FE_ALL_EXCEPT = 0x003D /* FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID*/
+};
+
+#define FE_INEXACT _FE_INEXACT
+#define FE_DIVBYZERO _FE_DIVBYZERO
+#define FE_UNDERFLOW _FE_UNDERFLOW
+#define FE_OVERFLOW _FE_OVERFLOW
+#define FE_INVALID _FE_INVALID
+#define FE_ALL_EXCEPT _FE_ALL_EXCEPT
+
+/* Definitions of rounding direction macros */
+enum {
+ _FE_TONEAREST = 0x0000,
+ _FE_TOWARDZERO = 0x0C00,
+ _FE_UPWARD = 0x0800,
+ _FE_DOWNWARD = 0x0400
+};
+
+#define FE_TONEAREST _FE_TONEAREST
+#define FE_TOWARDZERO _FE_TOWARDZERO
+#define FE_UPWARD _FE_UPWARD
+#define FE_DOWNWARD _FE_DOWNWARD
+
+/* default environment object */
+extern const fenv_t _FE_DFL_ENV;
+#define FE_DFL_ENV &_FE_DFL_ENV /* pointer to default environment */
+
+/*******************************************************************************
+* A environment object that sets to defualt settings and in addition sets the *
+* FZ and DAZ bits in the MXCSR, which causes flush-to-zero behavior of *
+* denormals. When using this environment, denormals encountered by XMM based *
+* calculation (which normally should be all single and double precision scalar *
+* floating point calculations, and all SSE/SSE2/SSE3 computation) will be *
+* treated as zero. Calculation results that are denormals will also be *
+* truncated to zero. This calculation mode is not IEEE-754 compliant, but may *
+* prevent lengthy stalls that occur in code that encounters denormals. It is *
+* suggested that you do not use this mode unless you have established that *
+* denormals are causing trouble for your code. Please use wisely. *
+* *
+* It is not possible to disable denorm stalls on calculation using the x87 FPU.*
+*******************************************************************************/
+extern const fenv_t _FE_DFL_DISABLE_SSE_DENORMS_ENV;
+#define FE_DFL_DISABLE_SSE_DENORMS_ENV &_FE_DFL_DISABLE_SSE_DENORMS_ENV
+
+/*******************************************************************************
+* The following functions provide high level access to the exception flags.*
+* The "int" input argument can be constructed by bitwise ORs of the *
+* exception macros: for example: FE_OVERFLOW | FE_INEXACT. *
+*******************************************************************************/
+
+/*******************************************************************************
+* The function "feclearexcept" clears the supported floating point *
+* exceptions represented by its argument. *
+*******************************************************************************/
+
+extern int feclearexcept(int /*excepts*/);
+
+
+/*******************************************************************************
+* The function "fegetexceptflag" stores a implementation-defined *
+* representation of the states of the floating-point status flags indicated *
+* by its integer argument excepts in the object pointed to by the argument, *
+* flagp. *
+*******************************************************************************/
+
+extern int fegetexceptflag(fexcept_t * /*flagp*/, int /*excepts*/);
+
+
+/*******************************************************************************
+* The function "feraiseexcept" raises the supported floating-point *
+* exceptions represented by its argument. The order in which these *
+* floating-point exceptions are raised is unspecified. *
+*******************************************************************************/
+
+extern int feraiseexcept(int /*excepts*/);
+
+
+/*******************************************************************************
+* The function "fesetexceptflag" sets or clears the floating point status *
+* flags indicated by the argument excepts to the states stored in the *
+* object pointed to by flagp. The value of the *flagp shall have been set *
+* by a previous call to fegetexceptflag whose second argument represented *
+* at least those floating-point exceptions represented by the argument *
+* excepts. This function does not raise floating-point exceptions; it just *
+* sets the state of the flags. *
+*******************************************************************************/
+
+extern int fesetexceptflag(const fexcept_t * /*flagp*/, int /*excepts*/);
+
+
+/*******************************************************************************
+* The function "fetestexcept" determines which of the specified subset of *
+* the floating-point exception flags are currently set. The excepts *
+* argument specifies the floating-point status flags to be queried. This *
+* function returns the value of the bitwise OR of the floating-point *
+* exception macros corresponding to the currently set floating-point *
+* exceptions included in excepts. *
+* *
+* On MacOS X for Intel, the result is the value of union of the *
+* corresponding result from the x87 and SSE floating point states. *
+*******************************************************************************/
+
+extern int fetestexcept(int /*excepts*/);
+
+
+/*******************************************************************************
+* The following functions provide control of rounding direction modes. *
+*******************************************************************************/
+
+/*******************************************************************************
+* The function "fegetround" returns the value of the rounding direction *
+* macro which represents the current rounding direction, or a negative *
+* if there is no such rounding direction macro or the current rounding *
+* direction is not determinable. *
+*******************************************************************************/
+
+extern int fegetround(void);
+
+
+/*******************************************************************************
+* The function "fesetround" establishes the rounding direction represented *
+* by its argument "round". If the argument is not equal to the value of a *
+* rounding direction macro, the rounding direction is not changed. It *
+* returns zero if and only if the argument is equal to a rounding *
+* direction macro. *
+*******************************************************************************/
+
+extern int fesetround(int /*round*/);
+
+
+/*******************************************************************************
+* The following functions manage the floating-point environment, exception *
+* flags and dynamic modes, as one entity. *
+*******************************************************************************/
+
+/*******************************************************************************
+* The fegetenv function stores the current floating-point enviornment in *
+* the object pointed to by envp. *
+*******************************************************************************/
+extern int fegetenv(fenv_t * /*envp*/);
+
+/*******************************************************************************
+* The feholdexcept function saves the current floating-point environment in *
+* the object pointed to by envp, clears the floating-point status flags, *
+* and then installs a non-stop (continue on floating-point exceptions) *
+* mode, if available, for all floating-point exceptions. The feholdexcept *
+* function returns zero if and only if non-stop floating-point exceptions *
+* handling was successfully installed. *
+*******************************************************************************/
+extern int feholdexcept(fenv_t * /*envp*/);
+
+/*******************************************************************************
+* The fesetnv function establishes the floating-point environment *
+* represented by the object pointed to by envp. The argument envp shall *
+* point to an object set by a call to fegetenv or feholdexcept, or equal to *
+* a floating-point environment macro -- we define only *FE_DFL_ENV and *
+* FE_DISABLE_SSE_DENORMS_ENV -- to be C99 standard compliant and portable *
+* to other architectures. Note that fesetnv merely installs the state of *
+* the floating-point status flags represented through its argument, and *
+* does not raise these floating-point exceptions. *
+* *
+* On MacOS X for Intel you may test and set the bits in *envp yourself, *
+* provided that you conditionalize the code appropriately to preserve *
+* portability and you follow the various strictures and suggestions *
+* provided by Intel in appropriate processor documentation. Please be aware *
+* that because there are two hardware locations for setting and reading *
+* floating point environment, this function (and others like it) are not *
+* atomic -- that is, for a brief period of time during the function call *
+* your new environment will have been applied to one but not both of the *
+* floating point engines (x87 and SSE). In addition, the behavior of some *
+* higher level interfaces (fegetround) is undefined if the x87 and SSE *
+* floating point units rounding modes are configured differently. Please *
+* use common sense. *
+*******************************************************************************/
+extern int fesetenv(const fenv_t * /*envp*/);
+
+/*******************************************************************************
+* The feupdateenv function saves the currently raised floating-point *
+* exceptions in its automatic storage, installs the floating-point *
+* environment represented by the object pointed to by envp, and then raises *
+* the saved floating-point exceptions. The argument envp shall point to an *
+* object set by a call to feholdexcept or fegetenv or equal a *
+* floating-point environment macro. *
+* *
+* Please see the description of feholdexcept for additional ways to create *
+* a fenv_t object, which are valid only for MacOS X for Intel. *
+*******************************************************************************/
+extern int feupdateenv(const fenv_t * /*envp*/);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __FENV__ */
+
diff --git a/tool/headers/architecture/arm/math.h b/tool/headers/architecture/arm/math.h
new file mode 100644
index 000000000..cb264017a
--- /dev/null
+++ b/tool/headers/architecture/arm/math.h
@@ -0,0 +1,611 @@
+/*
+ * Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+ *
+ * @APPLE_LICENSE_HEADER_START@
+ *
+ * The contents of this file constitute Original Code as defined in and
+ * are subject to the Apple Public Source License Version 1.1 (the
+ * "License"). You may not use this file except in compliance with the
+ * License. Please obtain a copy of the License at
+ * http://www.apple.com/publicsource and read it before using this file.
+ *
+ * This Original Code and all software distributed under the License are
+ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * @APPLE_LICENSE_HEADER_END@
+ */
+
+/*******************************************************************************
+* *
+* File: math.h *
+* *
+* Contains: typedefs, prototypes, and macros germane to C99 floating point.*
+* *
+*******************************************************************************/
+#ifndef __MATH__
+#define __MATH__
+
+#include "sys/cdefs.h" /* For definition of __DARWIN_UNIX03 et al */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/******************************************************************************
+* Floating point data types *
+******************************************************************************/
+
+/* Define float_t and double_t per C standard, ISO/IEC 9899:1999 7.12 2,
+ taking advantage of GCC's __FLT_EVAL_METHOD__ (which a compiler may
+ define anytime and GCC does) that shadows FLT_EVAL_METHOD (which a compiler
+ must and may define only in float.h).
+*/
+#if __FLT_EVAL_METHOD__ == 0
+ typedef float float_t;
+ typedef double double_t;
+#elif __FLT_EVAL_METHOD__ == 1
+ typedef double float_t;
+ typedef double double_t;
+#elif __FLT_EVAL_METHOD__ == 2 || __FLT_EVAL_METHOD__ == -1
+ typedef long double float_t;
+ typedef long double double_t;
+#else /* __FLT_EVAL_METHOD__ */
+ #error "Unsupported value of __FLT_EVAL_METHOD__."
+#endif /* __FLT_EVAL_METHOD__ */
+
+
+#if defined(__GNUC__)
+ #define HUGE_VAL __builtin_huge_val()
+ #define HUGE_VALF __builtin_huge_valf()
+ #define HUGE_VALL __builtin_huge_vall()
+ #define NAN __builtin_nanf("0x7fc00000") /* Constant expression, can be used as initializer. */
+ #define __MATH_H_ALWAYS_INLINE__ __attribute__ ((always_inline))
+#else
+ #define HUGE_VAL 1e500
+ #define HUGE_VALF 1e50f
+ #define HUGE_VALL 1e5000L
+ #define NAN __nan( )
+ #define __MATH_H_ALWAYS_INLINE__
+#endif
+
+#define INFINITY HUGE_VALF
+
+
+/******************************************************************************
+* Taxonomy of floating point data types *
+******************************************************************************/
+
+enum {
+ _FP_NAN = 1, /* NaN */
+ _FP_INFINITE = 2, /* + or - infinity */
+ _FP_ZERO = 3, /* + or - zero */
+ _FP_NORMAL = 4, /* all normal numbers */
+ _FP_SUBNORMAL = 5, /* denormal numbers */
+ _FP_SUPERNORMAL = 6 /* long double delivering > LDBL_DIG, e.g. 1. + 2^-1000 */
+};
+
+#define FP_NAN _FP_NAN
+#define FP_INFINITE _FP_INFINITE
+#define FP_ZERO _FP_ZERO
+#define FP_NORMAL _FP_NORMAL
+#define FP_SUBNORMAL _FP_SUBNORMAL
+#define FP_SUPERNORMAL _FP_SUPERNORMAL
+
+/* fma() *function call* is more costly than equivalent (in-line) multiply and add operations */
+/* For single and double precision, the cost isn't too bad, because we can fall back on higher */
+/* precision hardware, with the necessary range to handle infinite precision products. However, */
+/* expect the long double fma to be at least an order of magnitude slower than a simple multiply */
+/* and an add. */
+#undef FP_FAST_FMA
+#undef FP_FAST_FMAF
+#undef FP_FAST_FMAL
+
+/* The values returned by `ilogb' for 0 and NaN respectively. */
+#define FP_ILOGB0 (-2147483647 - 1)
+#define FP_ILOGBNAN (-2147483647 - 1)
+
+/* Bitmasks for the math_errhandling macro. */
+#define MATH_ERRNO 1 /* errno set by math functions. */
+#define MATH_ERREXCEPT 2 /* Exceptions raised by math functions. */
+
+#define math_errhandling (__math_errhandling())
+extern unsigned int __math_errhandling ( void );
+
+/********************************************************************************
+* *
+* Inquiry macros *
+* *
+* fpclassify Returns one of the FP_Å values. *
+* isnormal Non-zero if and only if the argument x is normalized. *
+* isfinite Non-zero if and only if the argument x is finite. *
+* isnan Non-zero if and only if the argument x is a NaN. *
+* signbit Non-zero if and only if the sign of the argument x is *
+* negative. This includes, NaNs, infinities and zeros. *
+* *
+********************************************************************************/
+
+#define fpclassify(x) \
+ ( sizeof (x) == sizeof(float ) ? __fpclassifyf((float)(x)) \
+ : sizeof (x) == sizeof(double) ? __fpclassifyd((double)(x)) \
+ : __fpclassify ((long double)(x)))
+
+extern int __fpclassifyf(float );
+extern int __fpclassifyd(double );
+extern int __fpclassify (long double);
+
+#if defined( __GNUC__ )
+ #define isnormal(x) \
+ ( sizeof (x) == sizeof(float ) ? __inline_isnormalf((float)(x)) \
+ : sizeof (x) == sizeof(double) ? __inline_isnormald((double)(x)) \
+ : __inline_isnormal ((long double)(x)))
+
+ #define isfinite(x) \
+ ( sizeof (x) == sizeof(float ) ? __inline_isfinitef((float)(x)) \
+ : sizeof (x) == sizeof(double) ? __inline_isfinited((double)(x)) \
+ : __inline_isfinite ((long double)(x)))
+
+ #define isinf(x) \
+ ( sizeof (x) == sizeof(float ) ? __inline_isinff((float)(x)) \
+ : sizeof (x) == sizeof(double) ? __inline_isinfd((double)(x)) \
+ : __inline_isinf ((long double)(x)))
+
+ #define isnan(x) \
+ ( sizeof (x) == sizeof(float ) ? __inline_isnanf((float)(x)) \
+ : sizeof (x) == sizeof(double) ? __inline_isnand((double)(x)) \
+ : __inline_isnan ((long double)(x)))
+
+ #define signbit(x) \
+ ( sizeof (x) == sizeof(float ) ? __inline_signbitf((float)(x)) \
+ : sizeof (x) == sizeof(double) ? __inline_signbitd((double)(x)) \
+ : __inline_signbit((long double)(x)))
+
+ static __inline__ int __inline_isfinitef (float ) __MATH_H_ALWAYS_INLINE__;
+ static __inline__ int __inline_isfinited (double ) __MATH_H_ALWAYS_INLINE__;
+ static __inline__ int __inline_isfinite (long double) __MATH_H_ALWAYS_INLINE__;
+ static __inline__ int __inline_isinff (float ) __MATH_H_ALWAYS_INLINE__;
+ static __inline__ int __inline_isinfd (double ) __MATH_H_ALWAYS_INLINE__;
+ static __inline__ int __inline_isinf (long double) __MATH_H_ALWAYS_INLINE__;
+ static __inline__ int __inline_isnanf (float ) __MATH_H_ALWAYS_INLINE__;
+ static __inline__ int __inline_isnand (double ) __MATH_H_ALWAYS_INLINE__;
+ static __inline__ int __inline_isnan (long double) __MATH_H_ALWAYS_INLINE__;
+ static __inline__ int __inline_isnormalf (float ) __MATH_H_ALWAYS_INLINE__;
+ static __inline__ int __inline_isnormald (double ) __MATH_H_ALWAYS_INLINE__;
+ static __inline__ int __inline_isnormal (long double) __MATH_H_ALWAYS_INLINE__;
+ static __inline__ int __inline_signbitf (float ) __MATH_H_ALWAYS_INLINE__;
+ static __inline__ int __inline_signbitd (double ) __MATH_H_ALWAYS_INLINE__;
+ static __inline__ int __inline_signbit (long double) __MATH_H_ALWAYS_INLINE__;
+
+ static __inline__ int __inline_isinff( float __x ) { return __builtin_fabsf(__x) == __builtin_inff(); }
+ static __inline__ int __inline_isinfd( double __x ) { return __builtin_fabs(__x) == __builtin_inf(); }
+ static __inline__ int __inline_isinf( long double __x ) { return __builtin_fabsl(__x) == __builtin_infl(); }
+ static __inline__ int __inline_isfinitef( float __x ) { return __x == __x && __builtin_fabsf(__x) != __builtin_inff(); }
+ static __inline__ int __inline_isfinited( double __x ) { return __x == __x && __builtin_fabs(__x) != __builtin_inf(); }
+ static __inline__ int __inline_isfinite( long double __x ) { return __x == __x && __builtin_fabsl(__x) != __builtin_infl(); }
+ static __inline__ int __inline_isnanf( float __x ) { return __x != __x; }
+ static __inline__ int __inline_isnand( double __x ) { return __x != __x; }
+ static __inline__ int __inline_isnan( long double __x ) { return __x != __x; }
+ static __inline__ int __inline_signbitf( float __x ) { union{ float __f; unsigned int __u; }__u = {__x}; return (int)(__u.__u >> 31); }
+ static __inline__ int __inline_signbitd( double __x ) { union{ double __f; unsigned long long __u; }__u = {__x}; return (int)(__u.__u >> 63); }
+ static __inline__ int __inline_signbit( long double __x ){ union{ long double __ld; struct{ unsigned long long __m; short __sexp; }__p; }__u = {__x}; return (int) ((unsigned int) __u.__p.__sexp >> 15); }
+ static __inline__ int __inline_isnormalf( float __x ) { float fabsf = __builtin_fabsf(__x); if( __x != __x ) return 0; return fabsf < __builtin_inff() && fabsf >= __FLT_MIN__; }
+ static __inline__ int __inline_isnormald( double __x ) { double fabsf = __builtin_fabs(__x); if( __x != __x ) return 0; return fabsf < __builtin_inf() && fabsf >= __DBL_MIN__; }
+ static __inline__ int __inline_isnormal( long double __x ) { long double fabsf = __builtin_fabsl(__x); if( __x != __x ) return 0; return fabsf < __builtin_infl() && fabsf >= __LDBL_MIN__; }
+
+#else
+
+ #define isnormal(x) \
+ ( sizeof (x) == sizeof(float ) ? __isnormalf((float)(x)) \
+ : sizeof (x) == sizeof(double) ? __isnormald((double)(x)) \
+ : __isnormal ((long double)(x)))
+
+ #define isfinite(x) \
+ ( sizeof (x) == sizeof(float ) ? __isfinitef((float)(x)) \
+ : sizeof (x) == sizeof(double) ? __isfinited((double)(x)) \
+ : __isfinite ((long double)(x)))
+
+ #define isinf(x) \
+ ( sizeof (x) == sizeof(float ) ? __isinff((float)(x)) \
+ : sizeof (x) == sizeof(double) ? __isinfd((double)(x)) \
+ : __isinf ((long double)(x)))
+
+ #define isnan(x) \
+ ( sizeof (x) == sizeof(float ) ? __isnanf((float)(x)) \
+ : sizeof (x) == sizeof(double) ? __isnand((double)(x)) \
+ : __isnan ((long double)(x)))
+
+ #define signbit(x) \
+ ( sizeof (x) == sizeof(float ) ? __signbitf((float)(x)) \
+ : sizeof (x) == sizeof(double) ? __signbitd((double)(x)) \
+ : __signbitl((long double)(x)))
+
+
+ extern int __isnormalf (float );
+ extern int __isnormald (double );
+ extern int __isnormal (long double);
+
+ extern int __isfinitef (float );
+ extern int __isfinited (double );
+ extern int __isfinite (long double);
+
+ extern int __isinff (float );
+ extern int __isinfd (double );
+ extern int __isinf (long double);
+
+ extern int __isnanf (float );
+ extern int __isnand (double );
+ extern int __isnan (long double);
+
+ extern int __signbitf (float );
+ extern int __signbitd (double );
+ extern int __signbitl (long double);
+
+#endif
+
+
+
+/********************************************************************************
+* *
+* Math Functions *
+* *
+********************************************************************************/
+
+extern double acos( double );
+extern float acosf( float );
+
+extern double asin( double );
+extern float asinf( float );
+
+extern double atan( double );
+extern float atanf( float );
+
+extern double atan2( double, double );
+extern float atan2f( float, float );
+
+extern double cos( double );
+extern float cosf( float );
+
+extern double sin( double );
+extern float sinf( float );
+
+extern double tan( double );
+extern float tanf( float );
+
+extern double acosh( double );
+extern float acoshf( float );
+
+extern double asinh( double );
+extern float asinhf( float );
+
+extern double atanh( double );
+extern float atanhf( float );
+
+extern double cosh( double );
+extern float coshf( float );
+
+extern double sinh( double );
+extern float sinhf( float );
+
+extern double tanh( double );
+extern float tanhf( float );
+
+extern double exp ( double );
+extern float expf ( float );
+
+extern double exp2 ( double );
+extern float exp2f ( float );
+
+extern double expm1 ( double );
+extern float expm1f ( float );
+
+extern double log ( double );
+extern float logf ( float );
+
+extern double log10 ( double );
+extern float log10f ( float );
+
+extern double log2 ( double );
+extern float log2f ( float );
+
+extern double log1p ( double );
+extern float log1pf ( float );
+
+extern double logb ( double );
+extern float logbf ( float );
+
+extern double modf ( double, double * );
+extern float modff ( float, float * );
+
+extern double ldexp ( double, int );
+extern float ldexpf ( float, int );
+
+extern double frexp ( double, int * );
+extern float frexpf ( float, int * );
+
+extern int ilogb ( double );
+extern int ilogbf ( float );
+
+extern double scalbn ( double, int );
+extern float scalbnf ( float, int );
+
+extern double scalbln ( double, long int );
+extern float scalblnf ( float, long int );
+
+extern double fabs( double );
+extern float fabsf( float );
+
+extern double cbrt( double );
+extern float cbrtf( float );
+
+extern double hypot ( double, double );
+extern float hypotf ( float, float );
+
+extern double pow ( double, double );
+extern float powf ( float, float );
+
+extern double sqrt( double );
+extern float sqrtf( float );
+
+extern double erf( double );
+extern float erff( float );
+
+extern double erfc( double );
+extern float erfcf( float );
+
+extern double lgamma( double );
+extern float lgammaf( float );
+
+extern double tgamma( double );
+extern float tgammaf( float );
+
+extern double ceil ( double );
+extern float ceilf ( float );
+
+extern double floor ( double );
+extern float floorf ( float );
+
+extern double nearbyint ( double );
+extern float nearbyintf ( float );
+
+extern double rint ( double );
+extern float rintf ( float );
+
+extern long int lrint ( double );
+extern long int lrintf ( float );
+
+extern long long int llrint ( double );
+extern long long int llrintf ( float );
+
+extern double round ( double );
+extern float roundf ( float );
+
+extern long int lround ( double );
+extern long int lroundf ( float );
+
+extern long long int llround ( double );
+extern long long int llroundf ( float );
+
+extern double trunc ( double );
+extern float truncf ( float );
+
+extern double fmod ( double, double );
+extern float fmodf ( float, float );
+
+extern double remainder ( double, double );
+extern float remainderf ( float, float );
+
+extern double remquo ( double, double, int * );
+extern float remquof ( float, float, int * );
+
+extern double copysign ( double, double );
+extern float copysignf ( float, float );
+
+extern double nan( const char * );
+extern float nanf( const char * );
+
+extern double nextafter ( double, double );
+extern float nextafterf ( float, float );
+
+extern double fdim ( double, double );
+extern float fdimf ( float, float );
+
+extern double fmax ( double, double );
+extern float fmaxf ( float, float );
+
+extern double fmin ( double, double );
+extern float fminf ( float, float );
+
+extern double fma ( double, double, double );
+extern float fmaf ( float, float, float );
+
+extern long double acosl(long double);
+extern long double asinl(long double);
+extern long double atanl(long double);
+extern long double atan2l(long double, long double);
+extern long double cosl(long double);
+extern long double sinl(long double);
+extern long double tanl(long double);
+extern long double acoshl(long double);
+extern long double asinhl(long double);
+extern long double atanhl(long double);
+extern long double coshl(long double);
+extern long double sinhl(long double);
+extern long double tanhl(long double);
+extern long double expl(long double);
+extern long double exp2l(long double);
+extern long double expm1l(long double);
+extern long double logl(long double);
+extern long double log10l(long double);
+extern long double log2l(long double);
+extern long double log1pl(long double);
+extern long double logbl(long double);
+extern long double modfl(long double, long double *);
+extern long double ldexpl(long double, int);
+extern long double frexpl(long double, int *);
+extern int ilogbl(long double);
+extern long double scalbnl(long double, int);
+extern long double scalblnl(long double, long int);
+extern long double fabsl(long double);
+extern long double cbrtl(long double);
+extern long double hypotl(long double, long double);
+extern long double powl(long double, long double);
+extern long double sqrtl(long double);
+extern long double erfl(long double);
+extern long double erfcl(long double);
+extern long double lgammal(long double);
+extern long double tgammal(long double);
+extern long double ceill(long double);
+extern long double floorl(long double);
+extern long double nearbyintl(long double);
+extern long double rintl(long double);
+extern long int lrintl(long double);
+extern long long int llrintl(long double);
+extern long double roundl(long double);
+extern long int lroundl(long double);
+extern long long int llroundl(long double);
+extern long double truncl(long double);
+extern long double fmodl(long double, long double);
+extern long double remainderl(long double, long double);
+extern long double remquol(long double, long double, int *);
+extern long double copysignl(long double, long double);
+extern long double nanl(const char *);
+extern long double nextafterl(long double, long double);
+extern double nexttoward(double, long double);
+extern float nexttowardf(float, long double);
+extern long double nexttowardl(long double, long double);
+extern long double fdiml(long double, long double);
+extern long double fmaxl(long double, long double);
+extern long double fminl(long double, long double);
+extern long double fmal(long double, long double, long double);
+
+#define isgreater(x, y) __builtin_isgreater ((x),(y))
+#define isgreaterequal(x, y) __builtin_isgreaterequal ((x),(y))
+#define isless(x, y) __builtin_isless ((x),(y))
+#define islessequal(x, y) __builtin_islessequal ((x),(y))
+#define islessgreater(x, y) __builtin_islessgreater ((x),(y))
+#define isunordered(x, y) __builtin_isunordered ((x),(y))
+
+extern double __inf( void );
+extern float __inff( void );
+extern long double __infl( void );
+extern float __nan( void ); /* 10.3 (and later) must retain in ABI for backward compatability */
+
+#if !defined(_ANSI_SOURCE)
+extern double j0 ( double );
+
+extern double j1 ( double );
+
+extern double jn ( int, double );
+
+extern double y0 ( double );
+
+extern double y1 ( double );
+
+extern double yn ( int, double );
+
+extern double scalb ( double, double );
+
+
+#define M_E 2.71828182845904523536028747135266250 /* e */
+#define M_LOG2E 1.44269504088896340735992468100189214 /* log 2e */
+#define M_LOG10E 0.434294481903251827651128918916605082 /* log 10e */
+#define M_LN2 0.693147180559945309417232121458176568 /* log e2 */
+#define M_LN10 2.30258509299404568401799145468436421 /* log e10 */
+#define M_PI 3.14159265358979323846264338327950288 /* pi */
+#define M_PI_2 1.57079632679489661923132169163975144 /* pi/2 */
+#define M_PI_4 0.785398163397448309615660845819875721 /* pi/4 */
+#define M_1_PI 0.318309886183790671537767526745028724 /* 1/pi */
+#define M_2_PI 0.636619772367581343075535053490057448 /* 2/pi */
+#define M_2_SQRTPI 1.12837916709551257389615890312154517 /* 2/sqrt(pi) */
+#define M_SQRT2 1.41421356237309504880168872420969808 /* sqrt(2) */
+#define M_SQRT1_2 0.707106781186547524400844362104849039 /* 1/sqrt(2) */
+
+#define MAXFLOAT ((float)3.40282346638528860e+38)
+extern int signgam; /* required for unix 2003 */
+
+
+#endif /* !defined(_ANSI_SOURCE) */
+
+#if !defined(__NOEXTENSIONS__) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
+#define __WANT_EXTENSIONS__
+#endif
+
+#ifdef __WANT_EXTENSIONS__
+
+#define FP_SNAN FP_NAN
+#define FP_QNAN FP_NAN
+
+extern long int rinttol ( double ); /* Legacy API: please use C99 lrint() instead. */
+
+extern long int roundtol ( double ); /* Legacy API: please use C99 lround() instead. */
+
+/*
+ * XOPEN/SVID
+ */
+#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
+#if (!defined(_XOPEN_SOURCE) || defined(_DARWIN_C_SOURCE))
+#if !defined(__cplusplus)
+/* used by matherr below */
+struct exception {
+ int type;
+ char *name;
+ double arg1;
+ double arg2;
+ double retval;
+};
+#endif
+
+#define HUGE MAXFLOAT
+
+/*
+ * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
+ * (one may replace the following line by "#include <values.h>")
+ */
+
+#define X_TLOSS 1.41484755040568800000e+16
+
+#define DOMAIN 1
+#define SING 2
+#define OVERFLOW 3
+#define UNDERFLOW 4
+#define TLOSS 5
+#define PLOSS 6
+
+#endif /* (!_XOPEN_SOURCE || _DARWIN_C_SOURCE) */
+#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
+
+#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
+extern int finite ( double ); /* Legacy API: please use C99 isfinite() instead. */
+
+extern double gamma ( double ); /* Legacy API: please use C99 tgamma() instead. */
+
+#if (!defined(_XOPEN_SOURCE) || defined(_DARWIN_C_SOURCE))
+
+#if !defined(__cplusplus)
+extern int matherr ( struct exception * );
+#endif
+
+/*
+ * IEEE Test Vector
+ */
+extern double significand ( double );
+
+/*
+ * BSD math library entry points
+ */
+extern double drem ( double, double ); /* Legacy API: please use C99 remainder() instead. */
+
+#endif /* (!_XOPEN_SOURCE || _DARWIN_C_SOURCE) */
+#endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
+
+#endif /* __WANT_EXTENSIONS__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MATH__ */