diff options
author | Kenneth Heafield <github@kheafield.com> | 2015-04-08 17:08:05 +0300 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2015-04-08 17:08:05 +0300 |
commit | 0698da8b0fd54825bdafbfffdd66f78ca2857927 (patch) | |
tree | 309a415fc9d67c3d2867c209a2373570853ac8a8 /moses/Util.h | |
parent | 2682cc0f9b43824c9ba47f1fc2e41a7ae5845da5 (diff) |
log(1 + ...) -> log1p(...)
Diffstat (limited to 'moses/Util.h')
-rw-r--r-- | moses/Util.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/moses/Util.h b/moses/Util.h index 48e6a51ae..68989721c 100644 --- a/moses/Util.h +++ b/moses/Util.h @@ -502,13 +502,11 @@ inline std::string GetFirstString(const std::string& str, int& first_pos, const template<class T> T log_sum (T log_a, T log_b) { - T v; if (log_a < log_b) { - v = log_b+log ( 1 + exp ( log_a-log_b )); + return log_b + log1p(exp(log_a - log_b)); } else { - v = log_a+log ( 1 + exp ( log_b-log_a )); + return log_a + log1p(exp(log_b - log_a)); } - return ( v ); } /** |