My Project
OSParameters.cpp
Go to the documentation of this file.
1/* $Id: OSParameters.cpp 4234 2011-07-29 12:45:13Z Gassmann $ */
17#include "OSConfig.h"
18#include "OSParameters.h"
19
20#include <cstdlib>
21
22#ifdef HAVE_CMATH
23# include <cmath>
24#else
25# ifdef HAVE_MATH_H
26# include <math.h>
27# else
28# error "don't have header file for math"
29# endif
30#endif
31#ifdef HAVE_CFLOAT
32# include <cfloat>
33#else
34# ifdef HAVE_FLOAT_H
35# include <float.h>
36# endif
37#endif
38#ifdef HAVE_CIEEEFP
39# include <cieeefp>
40#else
41# ifdef HAVE_IEEEFP_H
42# include <ieeefp.h>
43# endif
44#endif
45
46#include <sstream>
47
48using std::ostringstream;
49
50// this is taken directly from COINUTILS
51bool OSIsnan(double x)
52{
53#ifdef COIN_C_ISNAN
54 return COIN_C_ISNAN( x)!=0;
55#else
56 return (x != x);
57#endif
58}
59
60double OSNaN()
61{
62#ifdef OSNAN
63 return OSNAN;
64#else
65 // wow, what a last resort, I don't like this!
66 double zero = 0.0;
67 return 0.0/zero;
68#endif
69}
70
71std::string OSgetVersionInfo()
72{
73 ostringstream versionInfo;
74 versionInfo << std::endl << std::endl;
75 versionInfo << "Optimization Services Solver";
76 versionInfo << std::endl;
77 versionInfo << "Main Authors: Horand Gassmann, Jun Ma, and Kipp Martin";
78 versionInfo << std::endl;
79 versionInfo << "Distributed under the Eclipse Public License" ;
80 versionInfo << std::endl;
81
82// OS_VERSION is not an environment variable, so to inspect it requires a bit of care
83 ostringstream temp_version;
84 temp_version << OS_VERSION;
85
86 versionInfo << "OS Version: ";
87#if 0
88 if (temp_version.str() == "trunk")
89 {
90 versionInfo << "trunk";
91#ifdef OS_SVN_REV
92 versionInfo << std::endl;
93 versionInfo << "SVN Version: ";
94 versionInfo << OS_SVN_REV;
95#endif
96 }
97 else
98#endif
99 versionInfo << OS_VERSION;
100 versionInfo << std::endl;
101
102 versionInfo << "Build Date: ";
103 versionInfo << __DATE__;
104
105 versionInfo << std::endl << std::endl;
106 return versionInfo.str() ;
107}
std::string OSgetVersionInfo()
bool OSIsnan(double x)
checks whether a given double is NaN
double OSNaN()
returns the value for NaN used in OS
#define OS_VERSION
Definition config.h:206
#define COIN_C_ISNAN
Definition config.h:5
#define OSNAN