QByteArray to Double in QT C++ 5.8.0 : Im beginner in QT C++, I get struck here from last few days. Actually I have serial comport data read write program, Data is been 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 0.5  5.0  51.00  511.0 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 number like (eg: 1022/2=511)  [I have tried to convert the QbyteArray into Double for the calculation.]  Your help will be so helpful the finished my project thanks a lot.

here is the output [output][1]


  [1]: https://i.stack.imgur.com/97Y7z.png

       
         void MainWindow::readData()
     {
         QByteArray data = serial->readAll();
         bool ok;
         QByteArray cata= QByteArray::number(data.toDouble(&ok)/2);

        console->putData(cata);
     }


         

 