Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix VS2019 build warning caused by mixing floating point types.
  • Loading branch information
BillyONeal committed Jan 26, 2021
commit 880e535ccbbe6500cdbc0d2fc2d5eff0af255ef7
7 changes: 5 additions & 2 deletions Release/include/cpprest/streams.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "cpprest/astreambuf.h"
#include <iosfwd>
#include <cstdio>

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

if (state->exponent_number >= 0)
{
result *= pow(FloatingPoint(10.0), state->exponent_number);
result *= static_cast<FloatingPoint>(
std::pow(static_cast<FloatingPoint>(10.0), static_cast<FloatingPoint>(state->exponent_number)));

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

result /= pow(FloatingPoint(10.0), -state->exponent_number);
result /= static_cast<FloatingPoint>(
std::pow(static_cast<FloatingPoint>(10.0), static_cast<FloatingPoint>(-state->exponent_number)));

if (!is_zero && result > -std::numeric_limits<FloatingPoint>::denorm_min() &&
result < std::numeric_limits<FloatingPoint>::denorm_min())
Expand Down