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. Like every other Java recursion example, this exam
View Tutorial          By: Uriah at 2010-05-08 18:59:16

2. Hello there , i am unable to understand read and w
View Tutorial          By: deepak at 2014-12-10 14:04:42

3. example required
View Tutorial          By: revathy at 2009-09-03 01:53:04

4. hou to cal activity of one project into another pr
View Tutorial          By: manjunath at 2012-01-02 15:45:32

5. I got intersting idea about gauge,thanks...
View Tutorial          By: Marimuthu at 2009-07-20 00:56:27

6. i want to learn j2me basic to ....
View Tutorial          By: gopiraj at 2012-12-21 11:52:01

7. Good work!

Few changes: polish oper

View Tutorial          By: Karol Z. at 2010-06-02 09:09:52

8. There is no need to fight. ...whatever ku is sayin
View Tutorial          By: saurabh at 2009-07-30 15:19:49

9. i have asked for refercing the object of main clas
View Tutorial          By: deepesh at 2012-08-20 10:33:58

10. Thanks for the clear illustration of the MVC2 arch
View Tutorial          By: Tayo at 2010-01-03 12:53:46