Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


fixed point notation?

This topic is 5990 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m working on a program for my c++ class and I was curious if there was a way to make all the numbers show up in fixed point notation without typing setprecision() before each separate occurence. Its a bit disheartening when you have to type that 10 or 20 times. Is there some bit of code that would allow me to tell the program to output ALL the numbers in fixed point notation? Thanks in advance.

Share this post

Link to post
Share on other sites
If I remember correctly, once you set it, you dot have to UNLESS you want to output a diffrent number of decimals.
So, if you setprecision(2); then every output after that should have 2 until you set it to a diffrent value.
Course, I could be wrong though, I havent used it in a long while.

"cogito, ergo sum" -Descartes

Share this post

Link to post
Share on other sites
Define "show up." If you''re using an output stream, such as cout, you can use this pair of calls:


where x is the number of desired decimal places. I believe that''s a standard function, and its results persist past the output; that is, they''re nonvolatile.


//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[if you have a link proposal, email me.]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!