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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

significant digits with double

Status
Not open for further replies.

MinnisotaFreezing

Programmer
Jun 21, 2001
120
KR
Here is my question:

I need to do some manipulation with doubles, and when the manipulation is done, I want to store the data with only 2 significant digits. That is, 1.4569807 would be stored as 1.4600 or 1.4600000000 to whatever the double is.

To be more specific, I am using DDX to transfer my data through ODBC drivers, so I can't use fprintf("%.2f", data);

I can do this:

CString string.Format("%.2f", data);
data = atof(string);

but that seems a little silly.
Any suggestions?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top