use showpoint instead of fixed
std::fixed does not properly show numbers smaller then the number of digits shown -- it effectively truncates them to zero. std::showpoint will conserve them.
This is demonstrated by eg.
#include <iostream>
#include <sstream>
int main() {
double d = 1.e-12;
std::ostringstream ss; ss.setf( std::ios::showpoint );
std::ostringstream sf; sf.setf( std::ios::fixed );
ss << d ;
sf << d ;
std::cout << ss.str() << std::endl;
std::cout << sf.str() << std::endl;
}
which outputs
1.00000e-12
0.000000