ossama-othman / MaRC

MaRC - Map Reprojections and Conversions
GNU Lesser General Public License v2.1
1 stars 0 forks source link

Fixed problem where negative float data was not mapped. #4

Closed ossama-othman closed 7 years ago

ossama-othman commented 7 years ago

Float typed data less than -1 would not be mapped due to a bug in the data clipping implementation for the float data type. MaRC depended on -std::numeric_limits::max() - 1 to determine the minimum (lowest) mappable value of type float. However, the MaRC::Map_traits::minimum() specialization incorrectly used std::numeric_limits<>::min() instead of max(). The numeric_limits<>::min() trait provides the smallest representable value for floating point types, which is not the same as the lowest. The lowest is the negative of max(). This differs from numeric_limits<>::min() for integer types. To reduce confusion, consistently use the C++11 std::numeric_limits<>::lowest() trait throughout MaRC instead since it provides the desired behavior without having to if the type is an integer or a floating point. (Fixes #2)