Friday, January 6, 2012

For engineering programming, is any danger involved in using a %f type display format?

If your numbers are very small they could be printed as 0. For instance, if your are working with small measurements and you want to print 3.5 x 10^-12 meters and you use as a format $f, your output will be 0.000000. Therefore, in working with small numbers, to display meaningful results, you must use an exponential type format such as %e.

No comments:

Post a Comment