I am comparing the output of two programs, one C the other C++, using diff
, so the output must be identical.
Is there any way to printf
a double so that it is formatted as though it was printed using << mydouble
.
I am currently using printf("%g",mydouble)
Here are some examples of the differences:
c: 3.24769e-05 c++: 3.2477e-05
c: 0.0026572 c++: 0.00265721
Interestingly the scientific notation has more digits in c, and the decimal notation has more in c++.
printf
in the C++ might be easier. – Receptor