title: QByteArray to Double in Qt C++ 5.8.0
body: <p>I have a serial comport data read write program. Data is being read from the comport 4 (Eg: 1022), but when I'm trying to do a mathematical calculation of the data 1022/2 then its give me output as <code>0.5  5.0  51.00  511.0</code> means its not taking the whole 1022 as a single number for the mathematical calculation. Its take 1 first then divide 1/2=0.5 then once 0 digit receive it take as 10/2=5 and so on. But I want 1022 as a single digit number like (eg: 1022/2=511)  </p>
  
  <p>I have tried to convert the QByteArray into Double for the calculation.</p>
  
  <p><img src="https://i.stack.imgur.com/97Y7z.png" alt="output"></p>
  
  <pre><code>     void MainWindow::readData()
   {
       QByteArray data = serial-&gt;readAll();
       bool ok;
       QByteArray cata= QByteArray::number(data.toDouble(&amp;ok)/2);
  
      console-&gt;putData(cata);
   }
  </code></pre>