Sign in to follow this  
ShauwnBlue

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

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this