samedi 28 mars 2015

Print constant exponent value using printf in c



I used %e format specifier. Tried %3.2e or %4.3e.


Example:

if var=0.001342, then I want to print 0.1342e-02. But prints 1.342e-03

if var=0.543124, then I want to print 54.3124e-02. But prints 5.43124e-01

if var=0.0123653, then I want to print 1.23653e-02.


That is what ever maybe the value, I just want to fix my exponent value an print the result.




Aucun commentaire:

Enregistrer un commentaire