I am embedding python code in my c++ program. The use of PyFloat_AsDouble is causing loss of precision. It keeps only up to 6 precision digits. My program is very sensitive to precision. Is there a known fix for this? Here is the relevant C++ code:
_ret = PyObject_CallObject(pFunc, pArgs);
vector<double> retVals;
for(size_t i=0; i<PyList_Size(_ret); i++){
retVals[i] = PyFloat_AsDouble(PyList_GetItem(_ret, i));
}
retVals[i] has precision of only 6, while the value returned by the python code is a float that can have a higher precision. How to get full precision?