summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code
diff options
context:
space:
mode:
authorMorten Engvoldsen <morten.engvoldsen@nokia.com>2009-03-30 11:48:46 (GMT)
committerMorten Engvoldsen <morten.engvoldsen@nokia.com>2009-04-01 09:39:55 (GMT)
commit14d9633f576429b29257ed43143abc6de3918e5d (patch)
tree3167fa3877af6ae10ce1488d0b68b7034c25c337 /doc/src/snippets/code
parent914c2c25d0a60bc5c9d14f405a49b08a162c8908 (diff)
downloadQt-14d9633f576429b29257ed43143abc6de3918e5d.zip
Qt-14d9633f576429b29257ed43143abc6de3918e5d.tar.gz
Qt-14d9633f576429b29257ed43143abc6de3918e5d.tar.bz2
Adding note to the qFuzzyCompare doc
Adding note about how comparing using 0.0 will fail, and an example on how to do it. Reviewed-by: David Boddie Reviewed-by: Geir Vattekar
Diffstat (limited to 'doc/src/snippets/code')
-rw-r--r--doc/src/snippets/code/src_corelib_global_qglobal.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/src/snippets/code/src_corelib_global_qglobal.cpp b/doc/src/snippets/code/src_corelib_global_qglobal.cpp
index 72663e9..287181a 100644
--- a/doc/src/snippets/code/src_corelib_global_qglobal.cpp
+++ b/doc/src/snippets/code/src_corelib_global_qglobal.cpp
@@ -456,3 +456,11 @@ class MyClass : public QObject
//! [45]
QWidget w = QWidget();
//! [45]
+
+//! [46]
+ // Instead of comparing with 0.0
+ qFuzzyCompare(0.0,1.0e-200); // This will return false
+ // Compare adding 1 to both values will fix the problem
+ qFuzzyCompare(1 + 0.0, 1 + 1.0e-200); // This will return true
+//! [46]
+