/[escript]/trunk/esysUtils/src/maths.h
ViewVC logotype

Diff of /trunk/esysUtils/src/maths.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/paso/src/Common.h revision 1875 by phornby, Mon Oct 13 10:15:04 2008 UTC branches/domexper/paso/src/Common.h revision 3079 by jfenwick, Tue Aug 3 04:04:51 2010 UTC
# Line 1  Line 1 
1    
2  /*******************************************************  /*******************************************************
3  *  *
4  * Copyright (c) 2003-2008 by University of Queensland  * Copyright (c) 2003-2010 by University of Queensland
5  * Earth Systems Science Computational Center (ESSCC)  * Earth Systems Science Computational Center (ESSCC)
6  * http://www.uq.edu.au/esscc  * http://www.uq.edu.au/esscc
7  *  *
# Line 31  Line 31 
31  /* _ECC, __INTEL_COMPILER, and other                               */  /* _ECC, __INTEL_COMPILER, and other                               */
32  /* intel compiler pre-defines need to be handled                   */  /* intel compiler pre-defines need to be handled                   */
33  /* (__ICL, __ICC come to mind)                                     */  /* (__ICL, __ICC come to mind)                                     */
34  #if ( defined __INTEL_COMPILER )  #if defined(_WIN32) && defined(__INTEL_COMPILER)
35  #include <mathimf.h>  #include <mathimf.h>
36  #else  #else
37  #include <math.h>  #include <math.h>
# Line 64  typedef int err_t; Line 64  typedef int err_t;
64  #define EPSILON DBL_EPSILON  #define EPSILON DBL_EPSILON
65  #define LARGE_POSITIVE_FLOAT DBL_MAX  #define LARGE_POSITIVE_FLOAT DBL_MAX
66  #define SMALL_NEGATIVE_FLOAT -DBL_MAX  #define SMALL_NEGATIVE_FLOAT -DBL_MAX
67    /*#ifndef NAN
68       #define NAN (0.0/0.0)
69    #endif
70    */
71    /*#define IS_NAN(__VAL__)  ( (__VAL__) == NAN )*/  /* this does not work */
72    /* #define IS_NAN(__VAL__)  ( ! ( ( (__VAL__) >= 0. ) ||  ( (__VAL__) <= 0. ) ) )  this does not work */
73    
74    #ifdef isnan
75      #define IS_NAN(__VAL__) (isnan(__VAL__))
76    #elif defined _isnan
77      #define IS_NAN(__VAL__) (_isnan(__VAL__))
78    #else
79    /* If we do not have isnan then we can't reliably check for NaN - return false */
80      #define IS_NAN(__VAL__) (0)
81    #endif
82    
83  /**************************************************************/  /**************************************************************/
84    
# Line 92  typedef int err_t; Line 107  typedef int err_t;
107                                  _a0_= (_a1_); \                                  _a0_= (_a1_); \
108                                  _a1_=s; \                                  _a1_=s; \
109                                 }                                 }
110    #define XNOR(_a0_,_a1_) ( ( (_a0_) && (_a1_) ) || ( !(_a0_) && !(_a1_) ) )
111  /**************************************************************/  /**************************************************************/
112  /*    memory allocation:                                      */  /*    memory allocation:                                      */
113  /*    Wise to not use PASO_MALLOC/FREE/REALLOC and            */  /*    Wise to not use PASO_MALLOC/FREE/REALLOC and            */
# Line 117  typedef int err_t; Line 133  typedef int err_t;
133    
134  #endif  #endif
135    
136    #ifndef __const
137    # if (defined __STDC__ && __STDC__)
138    #  define __const   const
139    # else
140    #  define __const
141    # endif
142    #endif
143    
144    
145  /* FIXME: This is not satisfactory.                                */  /* FIXME: This is not satisfactory.                                */
146  /* _ECC, __INTEL_COMPILER, and other                               */  /* _ECC, __INTEL_COMPILER, and other                               */
# Line 134  typedef int err_t; Line 158  typedef int err_t;
158    #define PASO_THREAD_FREE PASO_FREE    #define PASO_THREAD_FREE PASO_FREE
159  #endif  #endif
160    
161    
162    /* Prepare for the day that this becomes sharable. */
163    /* and we wish to do multi-file optimisations on windows */
164    
165    #define PASO_DLL_API
166    
167    #ifdef _WIN32
168    #   ifndef PASO_STATIC_LIB
169    #      undef PASO_DLL_API
170    #      ifdef PASO_EXPORTS
171    #         define PASO_DLL_API __declspec(dllexport)
172    #      else
173    #         define PASO_DLL_API __declspec(dllimport)
174    #      endif
175    #   endif
176    #endif
177    
178    
179  /******************The main macros ************************************/  /******************The main macros ************************************/
180    
181  #define MEMALLOC(_LENGTH_,_TYPE_)                                     \  #define MEMALLOC(_LENGTH_,_TYPE_)                                     \

Legend:
Removed from v.1875  
changed lines
  Added in v.3079

  ViewVC Help
Powered by ViewVC 1.1.26