diff --git a/preprocessor/DynamicModel.cc b/preprocessor/DynamicModel.cc index cc16f5aaed7693c85c15681d2f7827ad58cec34e..19d7c8445efc40bfa05dbfd11753ed40a08f80ce 100644 --- a/preprocessor/DynamicModel.cc +++ b/preprocessor/DynamicModel.cc @@ -1607,6 +1607,11 @@ DynamicModel::writeDynamicCFile(const string &dynamic_basename, const int order) << " * Warning : this file is generated automatically by Dynare" << endl << " * from model file (.mod)" << endl << " */" << endl +#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) + << "#ifdef _MSC_VER" << endl + << "#define _USE_MATH_DEFINES" << endl + << "#endif" << endl +#endif << "#include <math.h>" << endl; if (external_functions_table.get_total_number_of_unique_model_block_external_functions()) @@ -4875,6 +4880,11 @@ DynamicModel::writeResidualsC(const string &basename, bool cuda) const << " * Warning : this file is generated automatically by Dynare" << endl << " * from model " << basename << "(.mod)" << endl << " */" << endl +#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) + << "#ifdef _MSC_VER" << endl + << "#define _USE_MATH_DEFINES" << endl + << "#endif" << endl +#endif << "#include <math.h>" << endl; mDynamicModelFile << "#include <stdlib.h>" << endl; @@ -4926,6 +4936,11 @@ DynamicModel::writeFirstDerivativesC(const string &basename, bool cuda) const << " * Warning : this file is generated automatically by Dynare" << endl << " * from model " << basename << "(.mod)" << endl << " */" << endl +#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) + << "#ifdef _MSC_VER" << endl + << "#define _USE_MATH_DEFINES" << endl + << "#endif" << endl +#endif << "#include <math.h>" << endl; mDynamicModelFile << "#include <stdlib.h>" << endl; @@ -4984,6 +4999,11 @@ DynamicModel::writeFirstDerivativesC_csr(const string &basename, bool cuda) cons << " * Warning : this file is generated automatically by Dynare" << endl << " * from model " << basename << "(.mod)" << endl << " */" << endl +#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) + << "#ifdef _MSC_VER" << endl + << "#define _USE_MATH_DEFINES" << endl + << "#endif" << endl +#endif << "#include <math.h>" << endl; mDynamicModelFile << "#include <stdlib.h>" << endl; @@ -5086,6 +5106,11 @@ DynamicModel::writeSecondDerivativesC_csr(const string &basename, bool cuda) con << " * Warning : this file is generated automatically by Dynare" << endl << " * from model " << basename << "(.mod)" << endl << " */" << endl +#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) + << "#ifdef _MSC_VER" << endl + << "#define _USE_MATH_DEFINES" << endl + << "#endif" << endl +#endif << "#include <math.h>" << endl; mDynamicModelFile << "#include <stdlib.h>" << endl; @@ -5180,6 +5205,11 @@ DynamicModel::writeThirdDerivativesC_csr(const string &basename, bool cuda) cons << " * Warning : this file is generated automatically by Dynare" << endl << " * from model " << basename << "(.mod)" << endl << " */" << endl +#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) + << "#ifdef _MSC_VER" << endl + << "#define _USE_MATH_DEFINES" << endl + << "#endif" << endl +#endif << "#include <math.h>" << endl; mDynamicModelFile << "#include <stdlib.h>" << endl; diff --git a/preprocessor/StaticModel.cc b/preprocessor/StaticModel.cc index 251cbe1e044dd284592bb866989cbe929a337e3a..b54f6277c84f4f6719d544c88598bdb534eccbac 100644 --- a/preprocessor/StaticModel.cc +++ b/preprocessor/StaticModel.cc @@ -1597,6 +1597,11 @@ StaticModel::writeStaticCFile(const string &func_name) const << " * Warning : this file is generated automatically by Dynare" << endl << " * from model file (.mod)" << endl << endl << " */" << endl +#if defined(_WIN32) || defined(__CYGWIN32__) || defined(__MINGW32__) + << "#ifdef _MSC_VER" << endl + << "#define _USE_MATH_DEFINES" << endl + << "#endif" << endl +#endif << "#include <math.h>" << endl; if (external_functions_table.get_total_number_of_unique_model_block_external_functions())