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

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

Java program to check if user input is an even number

Archived Comments

1. i really hate do while loop statement, can u pls h
View Tutorial          By: mARjO at 2011-09-01 03:50:18

2. Typecasting proved very much helpful to me...esp.
View Tutorial          By: itan at 2010-05-04 01:30:24

3. Thanks so much useful to me.
View Tutorial          By: Bhuvan at 2012-05-31 14:57:57

4. thnks lot 4 helping me
View Tutorial          By: sandeep dudi at 2011-11-17 06:06:03

5. Thank you very much. This is the easiest and also
View Tutorial          By: Mehmet Üsküp at 2013-06-17 21:08:08

6. Hi, these are the lines i added after i downloaded
View Tutorial          By: sandeep,p at 2012-11-22 10:17:07

7. hi RAMLAK i am akankshain and getting these erro
View Tutorial          By: akanksha at 2011-12-06 10:15:47

8. thanx it i very helpful 4 me as i m new with java
View Tutorial          By: akminder at 2011-08-09 05:09:19

9. awesome example
View Tutorial          By: jagjyot singh at 2010-01-12 20:39:04

10. Brief but Comprehensive. Excellent Effort.
View Tutorial          By: Farooq at 2011-11-16 14:14:52