it's an overoptimization. compile do it better. you can simplier write:
const double temp = static_cast< double >(ans[i].num)/ans[i].time;
if(!out.write(reinterpret_cast<const char *>(&temp), sizeof(temp))) {