- Related Questions & Answers
- What is the difference between Enumeration interface and enum in Java?
- float() in Python
- What is the difference between throw e and throw new Exception(e) in catch block in java?
- What is the difference between selenium and automation?
- What is difference between selenium 1 and Selenium 2
- Difference between import and package in Java?
- Difference between the byte stream and character stream classes in Java?
- Arrange first N natural numbers such that absolute difference between all adjacent elements > 1?
- What is difference between onCreate() and onStart() on Android?
- What is the difference between selenium WebDriver and TestNG?
- What is difference between selenium 2 and selenium 3?
- C Program for Difference between sums of odd and even digits?
- What's the difference between sizeof and alignof?
- Absolute Difference between the Sum of Non-Prime numbers and Prime numbers of an Array?
- Absolute Difference between the Product of Non-Prime numbers and Prime numbers of an Array?

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

As we know that in C/C++ we require float and double data type for the representation of Floating point numbers i.e the numbers which have decimal part with them. Now on the basis of precision provided by both of these data types, we can differentiate between both of them.

In simple words, it could be stated that double has 2x more precision as compare to float which means that double data type has double precision than as compare to that of the float data type.

In terms of a number of precision it can be stated as double has 64-bit precision for floating-point number (1 bit for the sign, 11 bits for the exponent, and 52* bits for the value), i.e. double has 15 decimal digits of precision. While float has 32 bit precision for floating number (8 bits for the exponent, and 23* for the value), i.e. float has 7 decimal digits of precision.

As double has more precision as compared to that of float then it is much obvious that it occupies twice memory as occupies by the float data type.

Also, range of both the data types could be represented as ±3.40282347E+38F i.e. 6-7 significant digits for float and ±1.79769313486231570E+308 i.e. 15-16 significant digits for double.

On the basis of the above points we can state that in case high precision is not required and the program only needs a huge array of decimal numbers to be stored float is a cost-effective way of storing data and saves memory while when more precision is required go for double.

Advertisements