1  /* file: libm_cpu_defs.h */
       2  
       3  
       4  // Copyright (c) 2000 - 2004, Intel Corporation
       5  // All rights reserved.
       6  //
       7  //
       8  // Redistribution and use in source and binary forms, with or without
       9  // modification, are permitted provided that the following conditions are
      10  // met:
      11  //
      12  // * Redistributions of source code must retain the above copyright
      13  // notice, this list of conditions and the following disclaimer.
      14  //
      15  // * Redistributions in binary form must reproduce the above copyright
      16  // notice, this list of conditions and the following disclaimer in the
      17  // documentation and/or other materials provided with the distribution.
      18  //
      19  // * The name of Intel Corporation may not be used to endorse or promote
      20  // products derived from this software without specific prior written
      21  // permission.
      22  
      23  //
      24  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
      25  // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
      26  // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
      27  // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
      28  // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
      29  // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
      30  // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
      31  // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
      32  // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
      33  // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
      34  // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      35  //
      36  // Intel Corporation is the author of this code, and requests that all
      37  // problem reports or change requests be submitted to it directly at
      38  // http://www.intel.com/software/products/opensource/libraries/num.htm.
      39  //
      40  
      41  #ifndef __LIBM_CPU_DEFS__H_INCLUDED__
      42  #define __LIBM_CPU_DEFS__H_INCLUDED__
      43  
      44  void __libm_sincos_pi4(double,double*,double*,int);
      45  void __libm_y0y1(double , double *, double *);
      46  void __libm_j0j1(double , double *, double *);
      47  double __libm_j0(double);
      48  double __libm_j1(double);
      49  double __libm_jn(int,double);
      50  double __libm_y0(double);
      51  double __libm_y1(double);
      52  double __libm_yn(int,double);
      53  
      54  double __libm_copysign (double, double);
      55  float __libm_copysignf (float, float);
      56  long double __libm_copysignl (long double, long double);
      57  
      58  extern double sqrt(double);
      59  extern double fabs(double);
      60  extern double log(double);
      61  extern double log1p(double);
      62  extern double sqrt(double);
      63  extern double sin(double);
      64  extern double exp(double);
      65  extern double modf(double, double *);
      66  extern double asinh(double);
      67  extern double acosh(double);
      68  extern double atanh(double);
      69  extern double tanh(double);
      70  extern double erf(double);
      71  extern double erfc(double);
      72  extern double j0(double);
      73  extern double j1(double);
      74  extern double jn(int, double);
      75  extern double y0(double);
      76  extern double y1(double);
      77  extern double yn(int, double);
      78  
      79  extern float  fabsf(float);
      80  extern float  asinhf(float);
      81  extern float  acoshf(float);
      82  extern float  atanhf(float);
      83  extern float  tanhf(float);
      84  extern float  erff(float);
      85  extern float  erfcf(float);
      86  extern float  j0f(float);
      87  extern float  j1f(float);
      88  extern float  jnf(int, float);
      89  extern float  y0f(float);
      90  extern float  y1f(float);
      91  extern float  ynf(int, float);
      92  
      93  extern long double log1pl(long double);
      94  extern long double logl(long double);
      95  extern long double sqrtl(long double);
      96  extern long double expl(long double);
      97  extern long double fabsl(long double);
      98  
      99  #if !(defined(SIZE_LONG_INT_32) || defined(SIZE_LONG_INT_64))
     100  #error long int size not established; define SIZE_LONG_INT_32 or SIZE_LONG_INT_64
     101  #endif
     102  
     103  #if (defined(SIZE_LONG_INT_32) && defined(SIZE_LONG_INT_64))
     104  #error multiple long int size definitions; define SIZE_LONG_INT_32 or SIZE_LONG_INT_64
     105  #endif
     106  
     107  #if !(defined(SIZE_LONG_LONG_INT_32) || defined(SIZE_LONG_LONG_INT_64))
     108  #error long long int size not established; define SIZE_LONG_LONG_INT_32 or SIZE_LONG_LONG_INT_64
     109  #endif
     110  
     111  #if (defined(SIZE_LONG_LONG_INT_32) && defined(SIZE_LONG_LONG_INT_64))
     112  #error multiple long long int size definitions; define SIZE_LONG_LONG_INT_32 or SIZE_LONG_LONG_INT_64
     113  #endif
     114  
     115  #define HI_SIGNIFICAND_LESS(X, HI) ((X)->hi_significand < 0x ## HI)
     116  #define f64abs(x) ((x) < 0.0 ? -(x) : (x))
     117  
     118  #define FP80_DECLARE()
     119  #define FP80_SET()
     120  #define FP80_RESET()
     121  
     122  #ifdef _LIBC
     123  # include <math.h>
     124  #else
     125  
     126  static const unsigned INF[] = {
     127      DOUBLE_HEX(7ff00000, 00000000),
     128      DOUBLE_HEX(fff00000, 00000000)
     129  };
     130  
     131  static const double _zeroo = 0.0;
     132  static const double _bigg = 1.0e300;
     133  static const double _ponee = 1.0;
     134  static const double _nonee = -1.0;
     135  
     136  #define INVALID    (_zeroo * *((double*)&INF[0]))
     137  #define PINF       *((double*)&INF[0])
     138  #define NINF       -PINF
     139  #define PINF_DZ    (_ponee/_zeroo)
     140  #define X_TLOSS    1.41484755040568800000e+16
     141  #endif
     142  
     143  /* Set these appropriately to make thread Safe */
     144  #define ERRNO_RANGE  errno = ERANGE
     145  #define ERRNO_DOMAIN errno = EDOM
     146  
     147  #ifndef _LIBC
     148  #if defined(__ICC) || defined(__ICL) || defined(__ECC) || defined(__ECL)
     149  # pragma warning( disable : 68 )	/* #68: integer conversion resulted in a change of sign */
     150  # pragma warning( disable : 186 )	/* #186: pointless comparison of unsigned integer with zero */
     151  # pragma warning( disable : 1572 )	/* #1572: floating-point equality and inequality comparisons are unreliable */
     152  #endif
     153  #endif
     154  
     155  #endif    /*__LIBM_CPU_DEFS__H_INCLUDED__*/