Changeset 79290f for pcp/src/init.h
- Timestamp:
- Jun 7, 2008, 1:13:29 PM (17 years ago)
- Children:
- 02bc3c
- Parents:
- a97897
- File:
-
- 1 edited
-
pcp/src/init.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pcp/src/init.h
ra97897 r79290f 17 17 */ 18 18 19 // Specifting whether a value in the parameter file must be specified or is optional 20 enum necessity { optional, //!< parameter is optional, if not given sensible value is chosen 21 critical //!< parameter must be given or programme won't initiate 22 }; 23 24 // Specifying the cast type to be read of a parameter, see ParseForParameter() 25 enum value_type { string_type, double_type, int_type, row_int, row_double, grid, lower_trigrid, upper_trigrid}; 19 #ifdef HAVE_CONFIG_H 20 #include <config.h> 21 #endif 26 22 27 23 /* Bereite mainname vor: loescht von filename von rechts nach links bis zu erstem "/" oder ganz */ … … 37 33 void InitPsisValue(struct Problem *const P, int start, int end); 38 34 39 /** Calculate the value \a x to the power of \a n.40 * \param x value41 * \param n power42 * \return \f$x^n\f$43 */44 static inline double tpow(double x, int n)45 {46 double y = 1;47 int neg = (n < 0);48 49 if (neg) n = -n;50 51 while (n) { // go through every bit of the integer number n52 if (n & 1) y *= x; // if bit set, multiply53 x *= x; // go to next power of 254 n >>= 1; // and to the next bit55 }56 return neg ? 1.0/y : y; // if n was negative, return reciprocal value57 }58 35 #endif 59 36
Note:
See TracChangeset
for help on using the changeset viewer.
