Skip to content

Commit

Permalink
Merge pull request #166 from /issues/166-removeScaling-check
Browse files Browse the repository at this point in the history
PointBuffer::removeScaling's checks for overflow are busted
  • Loading branch information
hobu committed Jul 19, 2013
2 parents 88bc00a + c677165 commit 083806e
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions include/pdal/Dimension.hpp
Expand Up @@ -437,25 +437,25 @@ class PDAL_DLL Dimension
{
T output = static_cast<T>(Utils::sround((v - m_numericOffset)/ m_numericScale));

if (std::numeric_limits<T>::is_exact) //
{
if (output > (std::numeric_limits<T>::max)())
{
std::ostringstream oss;
oss << "Dimension::removeScaling: scale and/or offset combination causes "
"re-scaled value to be greater than std::numeric_limits::max for dimension '" << getName() << "'. " <<
"value is: " << output << " and max() is: " << (std::numeric_limits<T>::max)();
}
else if (output < (std::numeric_limits<T>::min)())
{
std::ostringstream oss;
oss << "Dimension::removeScaling: scale and/or offset combination causes "
"re-scaled value to be less than std::numeric_limits::min for dimension '" << getName() << "'. " <<
"value is: " << output << " and min() is: " << (std::numeric_limits<T>::min)();
throw std::out_of_range(oss.str());

}
}
// if (std::numeric_limits<T>::is_exact) //
// {
// if (output > (std::numeric_limits<T>::max)())
// {
// std::ostringstream oss;
// oss << "Dimension::removeScaling: scale and/or offset combination causes "
// "re-scaled value to be greater than std::numeric_limits::max for dimension '" << getName() << "'. " <<
// "value is: " << output << " and max() is: " << (std::numeric_limits<T>::max)();
// }
// else if (output < (std::numeric_limits<T>::min)())
// {
// std::ostringstream oss;
// oss << "Dimension::removeScaling: scale and/or offset combination causes "
// "re-scaled value to be less than std::numeric_limits::min for dimension '" << getName() << "'. " <<
// "value is: " << output << " and min() is: " << (std::numeric_limits<T>::min)();
// throw std::out_of_range(oss.str());
//
// }
// }
return output;
}

Expand Down

0 comments on commit 083806e

Please sign in to comment.