Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Something weird
Forum Updated to NodeBB v4.3 + New Features

Something weird

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 477 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    plutoyoyo
    wrote on last edited by
    #1

    When I run case 1, the console output is "True";
    But when I run case 2, the console output is "False"

    I can't figure it out, somebody help me plz

    ====== Case 1 =========
    QVector <int> av;
    int max = 54;

    av.append(9);
    av.append(6);

    if(av.at(0) * av.at(1) == max)
    qDebug("True");
    else
    qDebug("False");

    ====== Case 2: =========
    QVector <double> av;
    double max = 0.54;

    av.append(0.9);
    av.append(0.6);

    if(av.at(0) * av.at(1) == max)
    qDebug("True");
    else
    qDebug("False");

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      try to do
      qDebug() << av.at(0) * av.at(1);

      It works here but i guess its random.
      http://floating-point-gui.de/

      alt text

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved