David Edmundson wrote:

> qFuzzyCompare ?

Yes, QVariant uses qFuzzyCompare internally, which means you get the 
precision that qFuzzyCompare hardcodes. You need to extract the double if 
you want to do something else.

We hit the same problem in work:

  double d1 = 1.000000000001;
  double d2 = 1.000000000002;

  QVariant v1(d1);
  QVariant v2(d2);

  qDebug()
           // False:
           << (d1 == d2)
           // True:
           << (v1 == v2)
           // False:
           << (v1.value<double>() == v2.value<double>());


Thanks,

Steve.


_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel

Reply via email to