Use std::pow in rtc_base/numerics.

Bug: webrtc:10433
Change-Id: If9d19a970e7bb2acc7782c9f9604dafccbb1d8ce
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128606
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27208}
This commit is contained in:
Mirko Bonadei
2019-03-20 07:09:48 +01:00
committed by Commit Bot
parent 22ed366fec
commit b5dd6b6558
2 changed files with 5 additions and 5 deletions

View File

@ -10,7 +10,7 @@
#include "rtc_base/numerics/exp_filter.h"
#include <math.h>
#include <cmath>
namespace rtc {
@ -28,7 +28,7 @@ float ExpFilter::Apply(float exp, float sample) {
} else if (exp == 1.0) {
filtered_ = alpha_ * filtered_ + (1 - alpha_) * sample;
} else {
float alpha = pow(alpha_, exp);
float alpha = std::pow(alpha_, exp);
filtered_ = alpha * filtered_ + (1 - alpha) * sample;
}
if (max_ != kValueUndefined && filtered_ > max_) {

View File

@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <math.h>
#include <cmath>
#include "rtc_base/numerics/exp_filter.h"
#include "test/gtest.h"
@ -26,7 +26,7 @@ TEST(ExpFilterTest, FirstTimeOutputEqualInput) {
}
TEST(ExpFilterTest, SecondTime) {
double value;
float value;
ExpFilter filter = ExpFilter(0.9f);
filter.Apply(100.0f, 10.0f);
@ -35,7 +35,7 @@ TEST(ExpFilterTest, SecondTime) {
value = 10.0f;
filter.Apply(10.0f, 20.0f);
double alpha = pow(0.9f, 10.0f);
float alpha = std::pow(0.9f, 10.0f);
value = alpha * value + (1.0f - alpha) * 20.0f;
EXPECT_FLOAT_EQ(value, filter.filtered());
}