Reputation: 3612
I am using mingw-gcc
and I want to print a float
.
#include <cstdio>
#include <iostream>
int main(){
float a =1.23;
std::cout << std::scientific << a << std::endl;
printf("%e\n",a);
return 0;
}
the output is
1.230000e+000
1.230000e+000
However float does not need more than two digits.
Is there any way in gcc
to export number with 2 digit exponent?
1.230000e+00
1.230000e+00
Is there any similar function like _set_output_format of Visual studio?
Upvotes: 0
Views: 468