When converting strings to long double I lose precision in QNX. Do you know how to fix this problem?
I am using c++. I have tried double and float and there were no problems.
#include <iostream>
#include <string>
#include <limits>
#include <sstream>
int main(){
    long double originalNumber = std::numeric_limits<long double>::max() / 2;
    long double convertedNumber;
    // From long double to string
    std::ostringstream ostr;
    ostr << originalNumber;
    std::string tmp_str = ostr.str();
    //From string to long double
    std::istringstream istr(tmp_str);
    istr >> convertedNumber;
    // Check if they are similar
    if (originalNumber == convertedNumber)
        std::cout<< "The same\n";
    else
        std::cout<< "Not the same\n";
    return 0;
}
The result is always Not the same
 
    