Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
How do you round off a float?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="David Harmon, post: 1524844"] On 1 Jan 2005 23:52:33 -0800 in comp.lang.c++, [email]kdlittle88@yahoo.com[/email] wrote, You do it when you format for display. cout << setprecision(2) << pi; Never expect an exact floating point value. Typical binary floating point implementation cannot even represent 3.1 exactly, so forget "rounding". Also, prefer double over float unless you have a specific reason. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
How do you round off a float?
Top