Comment on Tutorial - float vs double data types in Java By Baski



Comment Added by : William Fraser

Comment Added at : 2015-06-07 16:37:52

Comment on Tutorial : float vs double data types in Java By Baski
Actually, the given accuracy just barely exceeds what is possible in a float. A float is stored as: 1 sign bit, 23 mantissa bits, 1 sign bit for the exponent, and 7 bits for the exponent value.

Since the largest value that can be stored in 23 bits is 8388608, two consecutive floats in this region are:

8380398/131072 = 63.93736267
8380399/131072 = 63.9373703

Meaning that it can just barely distinguish between 63.93736 and 63.93737, which is still MUCH better than the human eye!


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. How could i read a file from my ftp server . sugge
View Tutorial          By: Dinshaw at 2015-02-06 07:22:03

2. hi can you send me the complete working code for
View Tutorial          By: avanti at 2007-10-04 02:30:04

3. It is very help full to me and very simple underst
View Tutorial          By: Reddymalla Babu Sircilla at 2013-02-22 08:28:22

4. Hello, Can you please send me the complete code to
View Tutorial          By: koksingh at 2008-01-15 00:22:40

5. wt about line of 35 {e.printStackTrace();} i don'
View Tutorial          By: Reddymalla Babu Sircilla at 2013-02-22 08:38:30

6. good one
View Tutorial          By: yogesh at 2010-07-24 21:18:24

7. Was useful
View Tutorial          By: Vasan at 2008-06-22 05:04:20

8. my question is how do this program connect to my
View Tutorial          By: ravisskit at 2012-10-08 12:00:18

9. In the 2nd example ,during the creation on object
View Tutorial          By: priyanka thakur at 2011-08-29 20:24:16

10. How can i read PDF files from external memory(SD c
View Tutorial          By: Aswanth at 2014-03-31 09:46:26