Weird behaviour loading double value from array
Hi all, I've found this really weird behaviour when loading a double value from array into a cv::Mat object. I do the following:
double foo_array[] = { -0.837231 };
cv::Mat foo(1, 1, cv::DataType<double>::type, foo_array);
std::cout << "foo: " << foo << std::endl;
and I got the output below:
foo: [-0.8372309999999999]
Why do I not get the exact value I entered? For any other numeric value it seems to behave properly. Any help would be greatly appreciated, thanks
I think precision used in opencv is better for cout. try this
You will get same result.