Forum Discussion
AlexeyKolosov
Staff
14 years agoHi Pasha,
The behavior you're facing is caused by a common problem with comparing floating-point numbers. In computers, floating-point numbers are represented as approximates rather than exact numbers (for example, the number 9211.00074695698 may really be 9211.00074695697999999999999), which may lead to comparison and presicion issues.
Currently, checkpoints cannot correctly compare some floating-point numbers due to these specifics. We have an existing feature request to improve the checkpoint mechanism for comparing floating-point values, and I've increased its rating based on your post.
Meanwhile, I'd suggest that you do not compare floating-point numbers directly, but instead subtract them and compare their difference against a very small value (used as the comparison precision). For example:
The behavior you're facing is caused by a common problem with comparing floating-point numbers. In computers, floating-point numbers are represented as approximates rather than exact numbers (for example, the number 9211.00074695698 may really be 9211.00074695697999999999999), which may lead to comparison and presicion issues.
Currently, checkpoints cannot correctly compare some floating-point numbers due to these specifics. We have an existing feature request to improve the checkpoint mechanism for comparing floating-point values, and I've increased its rating based on your post.
Meanwhile, I'd suggest that you do not compare floating-point numbers directly, but instead subtract them and compare their difference against a very small value (used as the comparison precision). For example:
var obj = Sys.Process("OptionsWorkshop").WPFObject("HwndSource: NewPositionForm", "New position").WPFObject("NewPositionForm", "New position", 1).WPFObject("DialogControl", "", 1).WPFObject("Grid", "", 1).WPFObject("PriceSpinner");
var diff = Math.abs(obj.Value - 9211.00074695698);
if (diff < 0.0000000001)
// values are equal
else
// values are not equal