diff options
author | Anderson Lizardo <anderson.lizardo@openbossa.org> | 2010-02-03 09:42:41 -0400 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2010-02-03 16:53:28 -0200 |
commit | e557d7f4990e17c92174ca434e90ef03c059825e (patch) | |
tree | 28b60107aa00b9778dc727e9a213d9067b4460c9 /tests/libsample/size.h | |
parent | 0fd47ac015e1eb01d06150ee453e52aac904f1e7 (diff) |
Add workaround for hardware bug that causes failures on two "size" tests.
Reviewed by Renato Araújo <renato.filho@openbossa.org>
Diffstat (limited to 'tests/libsample/size.h')
-rw-r--r-- | tests/libsample/size.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/libsample/size.h b/tests/libsample/size.h index cc9da4f2e..a1431a8b0 100644 --- a/tests/libsample/size.h +++ b/tests/libsample/size.h @@ -63,12 +63,22 @@ public: inline bool operator>(const Size& other) { - return calculateArea() > other.calculateArea(); + // On some x86 hardware and compiler combinations, floating point + // comparisons may fail due to a hardware bug. One workaround is to + // simplify comparison expressions by putting partial results in + // variables. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323#c109 + // for details. + double a = calculateArea(); + double b = other.calculateArea(); + return a > b; } inline bool operator<=(const Size& other) { - return calculateArea() <= other.calculateArea(); + // See comments for operator>() + double a = calculateArea(); + double b = other.calculateArea(); + return a <= b; } inline bool operator>=(const Size& other) |