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!

Round up floating point numbers

Status
Not open for further replies.

busman66

MIS
May 10, 2002
5
0
0
GB
Please could somebody tell me how to round up a floating point number to two decimal places.
 
For positive numbers:

double roundedResult,x=12.345;
roundedResult= floor(x * 100.0 + 0.5) / 100.0;

-mark-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top