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

Need help with rounding function for big number

Status
Not open for further replies.
Jul 30, 2003
1
0
0
US


Hi,
I'm trying to round a number in a C++ program to the tenthousandths place. Here's what I have, but it only rounds to the thousandth place then stops:

Code:
float Roundtenthousandth( float tenthousandth ) 
{ 
return static_cast<float>(floor( tenthousandth * 10000 + 0.5 ) / 10000 ); 
}
Thanks for your help, Iris

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top