cwNumericConvert.h : min range limit in numeric_convert() changed from double.min() to 0. See note in source.
This commit is contained in:
parent
aa7f945299
commit
01a9b7605a
@ -38,12 +38,12 @@ namespace cw
|
|||||||
{
|
{
|
||||||
// TODO: there is probably a way of using type_traits to make a more efficient comparison
|
// TODO: there is probably a way of using type_traits to make a more efficient comparison
|
||||||
// and avoid the double conversion
|
// and avoid the double conversion
|
||||||
double d_min = std::numeric_limits<DST_t>::min();
|
double d_min = 0; // std::numeric_limits<DST_t>::min() return smallest positive number which then fails this test when 'src' is zero.
|
||||||
double d_max = std::numeric_limits<DST_t>::max();
|
double d_max = std::numeric_limits<DST_t>::max();
|
||||||
if( d_min <= src and src <= d_max )
|
if( d_min <= (double)src && (double)src <= d_max )
|
||||||
dst = src;
|
dst = src;
|
||||||
else
|
else
|
||||||
return cwLogError(kInvalidArgRC,"Numeric conversion failed. The source value is outside the range of the destination value." );
|
return cwLogError(kInvalidArgRC,"Numeric conversion failed. The source value is outside the range of the destination value. min:%f max:%f src:%f",d_min,d_max,(double)src );
|
||||||
|
|
||||||
|
|
||||||
return kOkRC;
|
return kOkRC;
|
||||||
|
Loading…
Reference in New Issue
Block a user