Avoid -Wdouble-promotion warnings in headers

This commit is contained in:
Paul Cornett
2020-07-20 08:12:02 -07:00
parent 516aed372b
commit de7ab5527b
5 changed files with 13 additions and 11 deletions

View File

@@ -154,7 +154,7 @@ public:
void SetMin(ValueType min)
{
this->DoSetMin(min);
this->DoSetMin(static_cast<LongestValueType>(min));
}
ValueType GetMin() const
@@ -164,7 +164,7 @@ public:
void SetMax(ValueType max)
{
this->DoSetMax(max);
this->DoSetMax(static_cast<LongestValueType>(max));
}
ValueType GetMax() const
@@ -192,7 +192,7 @@ public:
if ( !control )
return false;
control->SetValue(NormalizeValue(*m_value));
control->SetValue(NormalizeValue(static_cast<LongestValueType>(*m_value)));
}
return true;
@@ -470,13 +470,15 @@ public:
}
private:
typedef typename Base::LongestValueType LongestValueType;
void DoSetMinMax()
{
// NB: Do not use min(), it's not the smallest representable value for
// the floating point types but rather the smallest representable
// positive value.
this->DoSetMin(-std::numeric_limits<ValueType>::max());
this->DoSetMax( std::numeric_limits<ValueType>::max());
this->DoSetMin(static_cast<LongestValueType>(-std::numeric_limits<ValueType>::max()));
this->DoSetMax(static_cast<LongestValueType>( std::numeric_limits<ValueType>::max()));
}
};