mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Fix range warning in ArrayHandleCast
`ArrayHandleCast` was giving warnings about casting to a type that could not hold the range to the source even when that was not true. The problem was it was using `std::numeric_limits::min` for the lower end of the range. But for floating point values, `min` is not really `min`. Rather, it is the smallest representable number. (This is probably a C++ bug we are stuck with.) You really need to use `lowest`.
This commit is contained in:
parent
2aed0b81c3
commit
e16fa28d6d
@ -184,8 +184,8 @@ private:
|
||||
using SrcLimits = std::numeric_limits<SrcComp>;
|
||||
using DstLimits = std::numeric_limits<DstComp>;
|
||||
|
||||
const vtkm::Range SrcRange{ SrcLimits::min(), SrcLimits::max() };
|
||||
const vtkm::Range DstRange{ DstLimits::min(), DstLimits::max() };
|
||||
const vtkm::Range SrcRange{ SrcLimits::lowest(), SrcLimits::max() };
|
||||
const vtkm::Range DstRange{ DstLimits::lowest(), DstLimits::max() };
|
||||
|
||||
const bool RangeLoss = (SrcRange.Max > DstRange.Max || SrcRange.Min < DstRange.Min);
|
||||
const bool PrecLoss = SrcLimits::digits > DstLimits::digits;
|
||||
|
Loading…
Reference in New Issue
Block a user