convertDoubleTo: invert the condition so we catch NaNs early
This is floating point, so De Morgan doesn't always apply. Change-Id: I89446ea06b5742efb194fffd16bb9e36025cb387 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
parent
0ca6ad8cfc
commit
1ee875dcac
@ -198,7 +198,7 @@ static inline bool convertDoubleTo(double v, T *value, bool allow_precision_upgr
|
|||||||
// T has more bits than double's mantissa, so don't allow "upgrading"
|
// T has more bits than double's mantissa, so don't allow "upgrading"
|
||||||
// to T (makes it look like the number had more precision than really
|
// to T (makes it look like the number had more precision than really
|
||||||
// was transmitted)
|
// was transmitted)
|
||||||
if (!allow_precision_upgrade && (v > double(max_mantissa) || v < double(-max_mantissa - 1)))
|
if (!allow_precision_upgrade && !(v <= double(max_mantissa) && v >= double(-max_mantissa - 1)))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user