Skip to content

Commit 880e535

Browse files
committed
Fix VS2019 build warning caused by mixing floating point types.
1 parent 3eb3c41 commit 880e535

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Release/include/cpprest/streams.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "cpprest/astreambuf.h"
1919
#include <iosfwd>
20+
#include <cstdio>
2021

2122
namespace Concurrency
2223
{
@@ -1434,7 +1435,8 @@ static pplx::task<FloatingPoint> _extract_result(std::shared_ptr<_double_state<F
14341435

14351436
if (state->exponent_number >= 0)
14361437
{
1437-
result *= pow(FloatingPoint(10.0), state->exponent_number);
1438+
result *= static_cast<FloatingPoint>(
1439+
std::pow(static_cast<FloatingPoint>(10.0), static_cast<FloatingPoint>(state->exponent_number)));
14381440

14391441
#pragma push_macro("max")
14401442
#undef max
@@ -1447,7 +1449,8 @@ static pplx::task<FloatingPoint> _extract_result(std::shared_ptr<_double_state<F
14471449
{
14481450
bool is_zero = (result == 0);
14491451

1450-
result /= pow(FloatingPoint(10.0), -state->exponent_number);
1452+
result /= static_cast<FloatingPoint>(
1453+
std::pow(static_cast<FloatingPoint>(10.0), static_cast<FloatingPoint>(-state->exponent_number)));
14511454

14521455
if (!is_zero && result > -std::numeric_limits<FloatingPoint>::denorm_min() &&
14531456
result < std::numeric_limits<FloatingPoint>::denorm_min())

0 commit comments

Comments
 (0)