Diffpack Documentation


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

genfc.h

Go to the documentation of this file.
00001 
00004 inline float sign (float a) 
00005 {
00006   return float( (a > 0.) ? 1. : ( (a < 0.) ? -1. : 0.) ); 
00007 }
00008 
00009 inline double sign (double a) 
00010 {
00011   return ( (a > 0.) ? 1. : ( (a < 0) ? -1. : 0.) ); 
00012 }
00013 
00014 inline int sign (int a) 
00015 {
00016   return ( (a > 0)  ? 1  : ( (a < 0) ? -1  : 0 ) ); 
00017 }
00018 
00019 
00020 #if !(defined(HP_ACC_Cplusplus) || defined(HP10x_ACC_Cplusplus) || defined(gpp2_Cplusplus) )
00021 inline float  abs      (float  r)          { return ( (r >= 0.0) ? r : -r ); }
00022 #endif
00023 
00024 inline float  sqr      (float  a)          { return a*a; }
00025 
00026 #if !(defined(IBM_Cplusplus) || defined(HP_Cplusplus) || defined (HP_ACC_Cplusplus) || defined (HP10x_ACC_Cplusplus) || defined(gpp2_Cplusplus) || defined(SPARC_Cplusplus) )
00027 inline double abs      (double  r)         { return ( (r >= 0.0) ? r : -r ); }
00028 #endif
00029 
00030 
00031 #if !(defined(HP_Cplusplus) || defined(HP10x_ACC_Cplusplus))
00032 inline int    sqr      (int  a)            { return a*a; }
00033 inline double sqr      (double  a)         { return a*a; }
00034 #endif
00035 
00036 #if (defined(HP_ACC_Cplusplus))
00037 inline real sqrt (int a) { return sqrt(real(a)); }
00038 #endif
00039 
00040 
00041 inline int    roundInt (double a)    { a += sign(a)*0.5; return ( int (a) ); }
00042 inline int    roundInt (float  a)    { a += sign(a)*0.5; return ( int (a) ); }
00043 
00044 inline real   getReal  (const real& a)     { return a; }
00045 inline int    char2int (char c)            { return int(c) - int('0'); }
00046 inline char   int2char (int i)             { return char(48+i) ; }
00047 
00048 
00049 
00050 
00051 
00052 extern char* oform (const char* fmt, ...);
00053 
00054 
00055 extern /*const*/ String aform (const char* fmt, ...);
00056 
00057 
00058 extern char* eform (const char* fmt, ...);
00059 
00060 
00061 inline char* oform2 (char* s, int i)       { return oform(s,i); }
00062 inline char* oform2 (char* s, float i)     { return oform(s,i); }
00063 inline char* oform2 (char* s, double i)    { return oform(s,i); }
00064 
00065 
00066 extern bool okFilename (const String& s);
00067 
00068 
00069 
00070 extern void stripString (char* s);
00071 
00072 
00073 
00074 
00075 
00076 void trigCoreDump ();
00077 
00078 
00079 
00080 real gammap (real a, real x);  
00081 real gammaq (real a, real x);  
00082 real gamm   (real x);          
00083 
00084 
00085 extern double  pow_eff  (double  a, double b); 
00086 extern int     pow_int  (int  a, int i);
00087 extern float   pow_int  (float   a, int i);
00088 extern double  pow_int  (double  a, int i);
00089 
00090 
00091 
00092 
00093 inline int    pow3     (int  a)            { return a*a*a; }
00094 inline int    pow4     (int  a)            { int b = a*a; return b*b; }
00095 inline float  pow3     (float   a)         { return a*a*a; }
00096 inline float  pow4     (float   a)         { float b = a*a; return b*b; }
00097 inline double pow3     (double  a)         { return a*a*a; }
00098 inline double pow4     (double  a)         { double b = a*a; return b*b; }
00099 
00100 /* these are defined in Complex.h:
00101 inline Complex pow3    (Complex a)         { return a*a*a; }
00102 inline Complex pow4    (Complex a)         { Complex b = a*a; return b*b; }
00103 */
00104 
00105 
00106 extern bool eq (const char* s1, const char* s2);
00107 extern bool eq (const String& s1, const char* s2);
00108 
00109 extern bool eq (float  a, float  b, real tol = comparison_tolerance);
00110 extern bool eq (double a, double b, real tol = comparison_tolerance);
00111 
00112 
00113 inline bool eq (int    a, int    b, real)      { return getbool(a==b); }
00114 inline bool eq (char   a, char   b, real)      { return getbool(a==b); }
00115 
00116 inline bool eq (int    a, int    b)            { return getbool(a==b); }
00117 inline bool eq (char   a, char   b)            { return getbool(a==b); }
00118 
00119 
00120 extern bool lt (float  a, float  b, real tol = comparison_tolerance);
00121 extern bool lt (double a, double b, real tol = comparison_tolerance);
00122 
00123 
00124 inline bool lt (int    a, int    b, real)      { return getbool(a<b); }
00125 inline bool lt (char   a, char   b, real)      { return getbool(a<b); }
00126 
00127 inline bool lt (int    a, int    b)            { return getbool(a<b); }
00128 inline bool lt (char   a, char   b)            { return getbool(a<b); }
00129 
00130 
00131 extern bool le (float  a, float  b, real tol = comparison_tolerance);
00132 extern bool le (double a, double b, real tol = comparison_tolerance);
00133 
00134 inline bool le (int    a, int    b, real)      { return getbool(a<=b); }
00135 inline bool le (char   a, char   b, real)      { return getbool(a<=b); }
00136 
00137 inline bool le (int    a, int    b)            { return getbool(a<=b); }
00138 inline bool le (char   a, char   b)            { return getbool(a<=b); }
00139 
00140 
00141 
00142 
00143 #ifdef WIN32
00144 # ifdef min
00145 #   pragma message("Replacing the MFC macro \"min\" with Diffpack functions") 
00146 #   undef min
00147 # endif
00148 # ifdef max
00149 #   pragma message("Replacing the MFC macro \"max\" with Diffpack functions") 
00150 #   undef max
00151 # endif
00152 #endif
00153 
00154 /* Maximum and minimum routines */
00155 
00156 inline int max(int arg1, int arg2)  
00157 { return (arg1 > arg2) ? arg1 : arg2; }
00158 
00159 inline float max(float arg1, float arg2)
00160 { return (arg1 > arg2) ? arg1 : arg2; }
00161 
00162 inline double max(double arg1, double arg2)
00163 { return (arg1 > arg2) ? arg1 : arg2; }
00164 
00165 inline int min(int arg1, int arg2)
00166 { return (arg1 < arg2) ? arg1 : arg2; }
00167 
00168 inline float min(float arg1, float arg2)
00169 { return (arg1 < arg2) ? arg1 : arg2; }
00170 
00171 inline double min(double arg1, double arg2)
00172 { return (arg1 < arg2) ? arg1 : arg2; }
00173 
00174 /* in Complex.h:
00175 inline Complex min(Complex arg1, Complex arg2)
00176 { return  (arg1 < arg2) ? arg1 : arg2; }
00177 
00178 inline Complex max(Complex arg1, Complex arg2)
00179 { return  (arg1 > arg2) ? arg1 : arg2; }
00180 */
00181 
00182 
00183 extern void externalpackmsg (void*,...);  
00184 
00185 
00186 extern "C" void MAIN__ ();  
00187 
00188 
00189 

Copyright © 2003 inuTech GmbH. All rights reserved.