J
JK
The following is a sample program I wrote..
float fTick = 0.0001;
float fLotSize = 100;
int iDeno = 10000;
double dVal;
double dInt;
dInt = fTick * fLotSize;
dVal = fTick * fLotSize * iDeno;
printf ("dVal : %g dInt : %g fTick: %g\n", dVal, dInt, fTick);
This is printing the output as :
dVal : 100 dInt : 0.01 fTick: 1e-04
If I use the format type "f" instead of "g" it prints the following
output
dVal : 99.999997 dInt : 0.010000 fTick: 0.000100
Here is my doubt. I always want the output in dddd.dddd ( where
dddd is one more decimal digits. It can go upto 10)
What should I give as the format specification to print the ouput in
the dddd.dddd format ?
Please help to resolve this problem..
FYI: I use g++ compiler (linux-gnu-2.4).
float fTick = 0.0001;
float fLotSize = 100;
int iDeno = 10000;
double dVal;
double dInt;
dInt = fTick * fLotSize;
dVal = fTick * fLotSize * iDeno;
printf ("dVal : %g dInt : %g fTick: %g\n", dVal, dInt, fTick);
This is printing the output as :
dVal : 100 dInt : 0.01 fTick: 1e-04
If I use the format type "f" instead of "g" it prints the following
output
dVal : 99.999997 dInt : 0.010000 fTick: 0.000100
Here is my doubt. I always want the output in dddd.dddd ( where
dddd is one more decimal digits. It can go upto 10)
What should I give as the format specification to print the ouput in
the dddd.dddd format ?
Please help to resolve this problem..
FYI: I use g++ compiler (linux-gnu-2.4).