[SF 2715031] DynamicAny double to float conversion

This commit is contained in:
Aleksandar Fabijanic
2009-04-01 19:15:22 +00:00
parent 11dc7df7e0
commit 019572be51
2 changed files with 21 additions and 2 deletions

View File

@@ -212,11 +212,16 @@ protected:
poco_static_assert (std::numeric_limits<T>::is_signed);
if (std::numeric_limits<F>::is_integer)
{
checkUpperLimit<F,T>(from);
checkLowerLimit<F,T>(from);
}
else
{
checkUpperLimitFloat<F,T>(from);
checkLowerLimit<F,T>(from);
checkLowerLimitFloat<F,T>(from);
}
to = static_cast<T>(from);
}
@@ -313,6 +318,13 @@ private:
throw RangeException("Value too large.");
}
template <typename F, typename T>
void checkLowerLimitFloat(const F& from) const
{
if (from < -std::numeric_limits<T>::max())
throw RangeException("Value too small.");
}
template <typename F, typename T>
void checkLowerLimit(const F& from) const
{