Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exponent output format (%e)

Status
Not open for further replies.

lupien1

Programmer
Mar 1, 2005
34
0
0
CA
When using « printf("%e", value) » the output use 3 digit for the exponent part (ex. 3.5e+004). How can i get a result with only 2 digit in the exponent part (ex. 3.5e+04)

Thank you


 
Unfortunately the exponent is fixed to 3 digits. You could sprintf it to a string, remove the third digit from the end and then printf the string.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top