Various minor changes for compatibility with MS Visual C++ and GCC 4.4
git-svn-id: https://www.dynare.org/svn/dynare/trunk@3105 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
8651edc42c
commit
31ed196c44
|
@ -3,6 +3,8 @@
|
|||
|
||||
/* $Id: formula.y 1749 2008-03-28 11:59:29Z kamenik $ */
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include "location.h"
|
||||
#include "formula_parser.h"
|
||||
#include "formula_tab.hh"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "parser_exception.h"
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
|
||||
using namespace ogp;
|
||||
|
||||
|
|
|
@ -456,7 +456,11 @@ bool ConstGeneralMatrix::isFinite() const
|
|||
{
|
||||
for (int i = 0; i < numRows(); i++)
|
||||
for (int j = 0; j < numCols(); j++)
|
||||
#ifndef _MSC_VER
|
||||
if (! std::isfinite(get(i,j)))
|
||||
#else
|
||||
if (! _finite(get(i,j)))
|
||||
#endif
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -354,7 +354,11 @@ double ConstVector::dot(const ConstVector& y) const
|
|||
bool ConstVector::isFinite() const
|
||||
{
|
||||
int i = 0;
|
||||
#ifndef _MSC_VER
|
||||
while (i < length() && isfinite(operator[](i)))
|
||||
#else
|
||||
while (i < length() && _finite(operator[](i)))
|
||||
#endif
|
||||
i++;
|
||||
return i == length();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,10 @@
|
|||
#include <sstream>
|
||||
#include "SparseMatrix.hh"
|
||||
|
||||
using namespace std;
|
||||
#ifdef _MSC_VER
|
||||
unsigned long _nan[2] = { 0xffffffff, 0x7fffffff };
|
||||
double NAN = *((double *) _nan);
|
||||
#endif
|
||||
|
||||
SparseMatrix::SparseMatrix()
|
||||
{
|
||||
|
@ -39,12 +42,7 @@ SparseMatrix::SparseMatrix()
|
|||
tbreak_g = 0;
|
||||
start_compare = 0;
|
||||
restart = 0;
|
||||
IM_i.clear();
|
||||
#ifdef _MSC_VER
|
||||
nan__[0] = 0xffffffff;
|
||||
nan__[1] = 0x7fffffff;
|
||||
NAN = *( double* )nan__;
|
||||
#endif
|
||||
IM_i.clear();
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -26,16 +26,51 @@
|
|||
#include <map>
|
||||
#include <ctime>
|
||||
#include "Mem_Mngr.hh"
|
||||
#ifdef _MSC_VER
|
||||
#include <limits>
|
||||
#endif
|
||||
#define NEW_ALLOC
|
||||
#define MARKOVITZ
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <limits>
|
||||
|
||||
extern unsigned long _nan[2];
|
||||
extern double NAN;
|
||||
|
||||
inline bool isnan(double value)
|
||||
{
|
||||
return _isnan(value);
|
||||
}
|
||||
|
||||
inline bool isinf(double value)
|
||||
{
|
||||
return (std::numeric_limits<double>::has_infinity &&
|
||||
value == std::numeric_limits<double>::infinity());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T asinh(T x)
|
||||
{
|
||||
return log(x+sqrt(x*x+1));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T acosh(T x)
|
||||
{
|
||||
if (!(x>=1.0))
|
||||
return sqrt(-1.0);
|
||||
return log(x+sqrt(x*x-1.0));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T atanh(T x)
|
||||
{
|
||||
if(!(x>-1.0 && x<1.0))
|
||||
return sqrt(-1.0);
|
||||
return log((1.0+x)/(1.0-x))/2.0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
struct t_save_op_s
|
||||
{
|
||||
|
@ -66,43 +101,6 @@ class SparseMatrix
|
|||
void fixe_u(double **u, int u_count_int, int max_lag_plus_max_lead_plus_1);
|
||||
void Read_SparseMatrix(string file_name, const int Size, int periods, int y_kmin, int y_kmax, bool steady_state, bool two_boundaries);
|
||||
void Read_file(string file_name, int periods, int u_size1, int y_size, int y_kmin, int y_kmax, int &nb_endo, int &u_count, int &u_count_init, double* u);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
unsigned long nan__[2];
|
||||
double NAN;
|
||||
|
||||
inline bool isnan(double value)
|
||||
{
|
||||
return value != value;
|
||||
}
|
||||
|
||||
inline bool isinf(double value)
|
||||
{
|
||||
return (std::numeric_limits<double>::has_infinity &&
|
||||
value == std::numeric_limits<double>::infinity());
|
||||
}
|
||||
|
||||
|
||||
inline double asinh(double x)
|
||||
{
|
||||
return log(x+sqrt(x*x+1));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T acosh(T x)
|
||||
{
|
||||
if(!(x>=1.0)) return sqrt(-1.0);
|
||||
return log(x+sqrt(x*x-1.0));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline T atanh(T x)
|
||||
{
|
||||
if(!(x>-1.0 && x<1.0)) return sqrt(-1.0);
|
||||
return log((1.0+x)/(1.0-x))/2.0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
void Init(int periods, int y_kmin, int y_kmax, int Size, map<pair<pair<int, int> ,int>, int> &IM);
|
||||
|
|
|
@ -36,6 +36,18 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
|
@ -1379,21 +1379,12 @@ UnaryOpNode::eval_opcode(UnaryOpcode op_code, double v) throw (EvalException)
|
|||
return(sinh(v));
|
||||
case oTanh:
|
||||
return(tanh(v));
|
||||
#ifndef _WIN64
|
||||
case oAcosh:
|
||||
return(acosh(v));
|
||||
case oAsinh:
|
||||
return(asinh(v));
|
||||
case oAtanh:
|
||||
return(atanh(v));
|
||||
#else
|
||||
case oAcosh:
|
||||
throw EvalException();
|
||||
case oAsinh:
|
||||
throw EvalException();
|
||||
case oAtanh:
|
||||
throw EvalException();
|
||||
#endif
|
||||
case oSqrt:
|
||||
return(sqrt(v));
|
||||
case oSteadyState:
|
||||
|
|
Loading…
Reference in New Issue