Quote:
Originally posted by edM
float number1 = 2.302E-12; //delcare & assign
[...]
printf("%f", number1);
when i went to print it out all i got was '0.000000'
|
printf()'s defaults to 6 digits after the decimal point for "%f " conversion. And 2.302E-12 is smaller than 0.000000, so it's rounded to zero.
Either printf if in E-notatation:
Code:
printf("%E\n", number1);
Or specify how much digits after the decimal point should be output (precision), e.g. to get 15 digits:
Code:
printf("%.15f\n", number1);