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..All ...to run this programs.first of of all u
View Tutorial          By: raavi.surendra at 2011-12-29 05:34:06

2. that was gud example to explain abstract. i have d
View Tutorial          By: zishan at 2010-05-20 00:21:46

3. Hi

Where puts this code in ror app

View Tutorial          By: martin at 2013-01-31 08:51:12

4. how to read a number from a keyboard and write tha
View Tutorial          By: aiswarya at 2015-09-13 03:48:05

5. This has tread error , copy and paster hole code a
View Tutorial          By: Daniel at 2015-01-21 16:24:36

6. it 's great
View Tutorial          By: tanawat bhtk at 2008-03-19 22:17:53

7. you can use multiple switch statements depending o
View Tutorial          By: moshood at 2012-04-01 13:24:41

8. Hi Jigar,
The above applicatio

View Tutorial          By: Kiran at 2011-12-26 04:00:24

9. Hi, thi's sursh laveti, actually I'm getting a pro
View Tutorial          By: suresh l at 2015-06-24 07:53:19

10. Very nice.
Thanks

View Tutorial          By: Kaviya at 2015-02-23 13:48:15