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. hi I am execute this code But message can't send <
View Tutorial          By: Sudhir Patil at 2011-02-01 10:28:28

2. whoo... its very hard
View Tutorial          By: Anonymous at 2009-01-13 20:17:20

3. Well explained. Example clear out the diff
View Tutorial          By: sonam at 2014-06-25 19:05:20

4. Hi!
this morning when i tried to logon a pr

View Tutorial          By: Lukas at 2013-03-03 13:35:42

5. I have no mounted the sd card, and I have the &quo
View Tutorial          By: Cgamboa at 2012-12-01 06:39:14

6. This is the coding that I wanted...
This is

View Tutorial          By: Damith at 2012-05-16 17:26:10

7. This is totally great. Your explaination make me u
View Tutorial          By: Cipom at 2010-04-11 18:41:04

8. Very nice article.. thanks
View Tutorial          By: Basu at 2010-05-29 05:52:00

9. PLZ HELP ME WITH THIS.. WHEN I RUN THE FILE ON APA
View Tutorial          By: Rahul at 2012-08-18 12:26:39

10. its very helpful..thank you..
View Tutorial          By: roja at 2013-06-16 12:37:32