Use the actual type of the value, not LongestValueType, for storing m_min and m_max as this is necessary for the comparisons between the value and them to work correctly for unsigned types. Also check for precision loss when converting from the bigger LongestValueType to the actual type. Add new unit tests, that failed before, but pass now.