Jump to content
  • Advertisement
Sign in to follow this  
ShauwnBlue

How can I get my application to print more decimal places?

This topic is 4122 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 wrote an e and a pi generator in Java as a couple of my first programs many months ago. However, when I would print the number, it would cut it off to about 15 or so decimals. How can I make my application give more decimal places? Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
You can't store an infinite amount of information in finite space ;)

Every decimal digit needs log10/log2 = 3.322 binary digits (bits) storage space. Since a double only holds 53 bits of mantissa, you end up with 15.95 decimal digits.

If that is not enough for your needs, use another data type.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!