diff options
author | Jeroen Vermeulen <jtv@precisiontranslationtools.com> | 2015-02-13 15:54:29 +0300 |
---|---|---|
committer | Jeroen Vermeulen <jtv@precisiontranslationtools.com> | 2015-02-13 15:54:29 +0300 |
commit | 63299df44737134f45533479723b6535a7d3a6da (patch) | |
tree | 265f413b0e41cbb2f49824a9bfcf4c225a388b19 /moses | |
parent | e1d60211a4b14a3f7eb090aaa70e0293ecec2437 (diff) |
Fix undefined isnan() on Cygwin gcc 4.8.
Include <cmath>, where isnan() is defined, and qualify use with namespace: std::isnan().
Diffstat (limited to 'moses')
-rw-r--r-- | moses/Syntax/F2S/HyperTreeLoader.cpp | 5 | ||||
-rw-r--r-- | moses/Syntax/T2S/RuleTrieLoader.cpp | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/moses/Syntax/F2S/HyperTreeLoader.cpp b/moses/Syntax/F2S/HyperTreeLoader.cpp index 8dcadef55..54e34412a 100644 --- a/moses/Syntax/F2S/HyperTreeLoader.cpp +++ b/moses/Syntax/F2S/HyperTreeLoader.cpp @@ -1,8 +1,9 @@ #include "HyperTreeLoader.h" #include <sys/stat.h> -#include <stdlib.h> +#include <cmath> +#include <stdlib.h> #include <fstream> #include <string> #include <iterator> @@ -93,7 +94,7 @@ bool HyperTreeLoader::Load(const std::vector<FactorType> &input, for (util::TokenIter<util::AnyCharacter, true> s(scoreString, " \t"); s; ++s) { int processed; float score = converter.StringToFloat(s->data(), s->length(), &processed); - UTIL_THROW_IF2(isnan(score), "Bad score " << *s << " on line " << count); + UTIL_THROW_IF2(std::isnan(score), "Bad score " << *s << " on line " << count); scoreVector.push_back(FloorScore(TransformScore(score))); } const std::size_t numScoreComponents = ff.GetNumScoreComponents(); diff --git a/moses/Syntax/T2S/RuleTrieLoader.cpp b/moses/Syntax/T2S/RuleTrieLoader.cpp index 9feaefc94..248bf8140 100644 --- a/moses/Syntax/T2S/RuleTrieLoader.cpp +++ b/moses/Syntax/T2S/RuleTrieLoader.cpp @@ -1,8 +1,9 @@ #include "RuleTrieLoader.h" #include <sys/stat.h> -#include <stdlib.h> +#include <cmath> +#include <cstdlib> #include <fstream> #include <string> #include <iterator> @@ -88,7 +89,7 @@ bool RuleTrieLoader::Load(const std::vector<FactorType> &input, for (util::TokenIter<util::AnyCharacter, true> s(scoreString, " \t"); s; ++s) { int processed; float score = converter.StringToFloat(s->data(), s->length(), &processed); - UTIL_THROW_IF2(isnan(score), "Bad score " << *s << " on line " << count); + UTIL_THROW_IF2(std::isnan(score), "Bad score " << *s << " on line " << count); scoreVector.push_back(FloorScore(TransformScore(score))); } const std::size_t numScoreComponents = ff.GetNumScoreComponents(); |