summaryrefslogtreecommitdiffstats
path: root/vdslib
diff options
context:
space:
mode:
authorArne Juul <arnej@yahoo-inc.com>2016-06-27 13:17:45 +0200
committerArne Juul <arnej@yahoo-inc.com>2016-06-27 13:17:45 +0200
commit558993d4df403692ac78a8c308588167ed8cb884 (patch)
treef25cd71595f19985457979265208d908320e2644 /vdslib
parentb354b88d3eae5525d2859f602b215e55d4e3b2fa (diff)
use cmath
* avoid using #include <math.h> * add std:: namespace prefix when calling <cmath> functions
Diffstat (limited to 'vdslib')
-rw-r--r--vdslib/src/tests/distribution/datadistributiontest.cpp1
-rw-r--r--vdslib/src/tests/distribution/distributiontest.cpp2
-rw-r--r--vdslib/src/vespa/vdslib/distribution/distribution.cpp10
3 files changed, 6 insertions, 7 deletions
diff --git a/vdslib/src/tests/distribution/datadistributiontest.cpp b/vdslib/src/tests/distribution/datadistributiontest.cpp
index 8bdc1d86120..f81e0992756 100644
--- a/vdslib/src/tests/distribution/datadistributiontest.cpp
+++ b/vdslib/src/tests/distribution/datadistributiontest.cpp
@@ -6,7 +6,6 @@
#include <vespa/vdslib/distribution/distribution.h>
#include <vespa/vdslib/state/clusterstate.h>
#include <vespa/vdslib/state/random.h>
-#include <math.h>
#include <ctime>
#include <tests/distribution/bucketvector.h>
#include <tests/distribution/randombucket.h>
diff --git a/vdslib/src/tests/distribution/distributiontest.cpp b/vdslib/src/tests/distribution/distributiontest.cpp
index 6103762abd8..698b5f8da09 100644
--- a/vdslib/src/tests/distribution/distributiontest.cpp
+++ b/vdslib/src/tests/distribution/distributiontest.cpp
@@ -736,7 +736,7 @@ getMaxAbs(const std::vector<int> distribution, double avg, int start)
{
int max = start;
for (uint32_t i = 0; i < distribution.size(); i++) {
- if(fabs(distribution[i]-avg) > fabs(distribution[max]-avg))
+ if (std::fabs(distribution[i]-avg) > std::fabs(distribution[max]-avg))
max = i;
}
return max;
diff --git a/vdslib/src/vespa/vdslib/distribution/distribution.cpp b/vdslib/src/vespa/vdslib/distribution/distribution.cpp
index 0ed571b1b35..d5cea4920c2 100644
--- a/vdslib/src/vespa/vdslib/distribution/distribution.cpp
+++ b/vdslib/src/vespa/vdslib/distribution/distribution.cpp
@@ -286,8 +286,8 @@ Distribution::getIdealDisk(const NodeState& nodeState, uint16_t nodeIndex,
continue;
}
if (diskState.getCapacity() != 1.0) {
- score = pow(score,
- 1.0 / diskState.getCapacity().getValue());
+ score = std::pow(score,
+ 1.0 / diskState.getCapacity().getValue());
}
if (score > maxScore) {
maxScore = score;
@@ -412,7 +412,7 @@ Distribution::getIdealGroups(const document::BucketId& bucket,
if (it->second->getCapacity() != 1) {
// Capacity shouldn't possibly be 0.
// Verified in Group::setCapacity()
- score = pow(score, 1.0 / it->second->getCapacity().getValue());
+ score = std::pow(score, 1.0 / it->second->getCapacity().getValue());
}
if (score > tmpResults.back()._score) {
tmpResults.push_back(ScoredGroup(it->second, score));
@@ -457,7 +457,7 @@ Distribution::getIdealDistributorGroup(const document::BucketId& bucket,
if (it->second->getCapacity() != 1) {
// Capacity shouldn't possibly be 0.
// Verified in Group::setCapacity()
- score = pow(score, 1.0 / it->second->getCapacity().getValue());
+ score = std::pow(score, 1.0 / it->second->getCapacity().getValue());
}
if (score > result._score) {
if (!_distributorAutoOwnershipTransferOnWholeGroupDown
@@ -577,7 +577,7 @@ Distribution::getIdealNodes(const NodeType& nodeType,
double score = random.nextDouble();
++randomIndex;
if (nodeState.getCapacity() != vespalib::Double(1.0)) {
- score = pow(score, 1.0 / nodeState.getCapacity().getValue());
+ score = std::pow(score, 1.0 / nodeState.getCapacity().getValue());
}
if (score > tmpResults.back()._score) {
for (std::list<ScoredNode>::iterator it = tmpResults.begin();