diff options
author | Arne Juul <arnej@yahoo-inc.com> | 2016-06-27 13:10:56 +0200 |
---|---|---|
committer | Arne Juul <arnej@yahoo-inc.com> | 2016-06-27 13:10:59 +0200 |
commit | b3c7881d29b2ce40c4211dd8d29d2509f7689ca9 (patch) | |
tree | e58bd8b5ab7af403f965b4fe4b46b42e17ba5de1 /fsa | |
parent | d86e461682389d96ce4081647ff1a76afd78b4b3 (diff) |
use cmath
* avoid using #include <math.h>
* add std:: namespace prefix when calling <cmath> functions
* use <cstdlib> for std::abs() on integral types
Diffstat (limited to 'fsa')
-rw-r--r-- | fsa/src/vespa/fsa/detector.cpp | 3 | ||||
-rw-r--r-- | fsa/src/vespa/fsa/unicode.cpp | 4 | ||||
-rw-r--r-- | fsa/src/vespa/fsa/vectorizer.cpp | 8 |
3 files changed, 6 insertions, 9 deletions
diff --git a/fsa/src/vespa/fsa/detector.cpp b/fsa/src/vespa/fsa/detector.cpp index f9e92c994d5..196d6908342 100644 --- a/fsa/src/vespa/fsa/detector.cpp +++ b/fsa/src/vespa/fsa/detector.cpp @@ -14,8 +14,7 @@ #include <list> #include <algorithm> - -#include <math.h> +#include <cmath> #include "detector.h" #include "fsa.h" diff --git a/fsa/src/vespa/fsa/unicode.cpp b/fsa/src/vespa/fsa/unicode.cpp index 4a35e79ff12..ee0cdad1766 100644 --- a/fsa/src/vespa/fsa/unicode.cpp +++ b/fsa/src/vespa/fsa/unicode.cpp @@ -6,7 +6,7 @@ #include "unicode.h" #include <assert.h> -#include <stdlib.h> +#include <cstdlib> namespace fsa { @@ -521,7 +521,7 @@ int Unicode::utf8move(unsigned const char* start, size_t length, if (offset == 0) // Enough room to make it.. { - int moved = abs(p - pos); + int moved = std::abs(p - pos); pos = p; return moved; } diff --git a/fsa/src/vespa/fsa/vectorizer.cpp b/fsa/src/vespa/fsa/vectorizer.cpp index 54c67fdc800..41f3ce66965 100644 --- a/fsa/src/vespa/fsa/vectorizer.cpp +++ b/fsa/src/vespa/fsa/vectorizer.cpp @@ -13,13 +13,11 @@ #include <list> #include <algorithm> - -#include <math.h> +#include <cmath> #include "vectorizer.h" #include "fsa.h" - namespace fsa { // {{{ Vectorizer::TfIdf::weight @@ -35,7 +33,7 @@ double Vectorizer::TfIdf::weight(unsigned int tfnorm, unsigned int idfnorm, else{ tf_n = (double)_tf/tfnorm; if(tfexp!=1.0 && tf_n!=0.0){ - tf_n = exp(tfexp*log(tf_n)); + tf_n = std::exp(tfexp * std::log(tf_n)); } } @@ -47,7 +45,7 @@ double Vectorizer::TfIdf::weight(unsigned int tfnorm, unsigned int idfnorm, if(idf_n<0.0) idf_n = 0.0; if(idfexp!=1.0 && idf_n!=0.0){ - idf_n = exp(idfexp*log(idf_n)); + idf_n = std::exp(idfexp * std::log(idf_n)); } } |