Yogesh Chauhan's Blog

What is the difference between float and double?

in Miscellaneous on February 23, 2020


It has the double precision (15 decimal digits of precision). It usually occupies 64 bits in computer memory and represents fractional values. double occupies twice the memory occupied by float. 

Double precision may be chosen when the range or precision of single precision would be insufficient.

One of the first programming languages to provide single- and double-precision floating-point data types was Fortran.

Double takes 8 bytes for storage.


It has single precision (7 decimal digits of precision). It usually occupies 32 bits in computer memory and represents a wide dynamic range of numeric values.

Float takes 4 bytes for storage.   

NOTE: Here's how the number of digits are calculated:

double has 52 mantissa bits + 1 hidden bit = 53 bits: (53*log(2))/log(10) = 15.95 digits

float has 23 mantissa bits + 1 hidden bit = 24 bits: (24*log(2))/log(10) = 7.22 digits

Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 How to add Read More Read Less Button using JavaScript? #3 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface #Jan 14 How to display a student’s individual transcript in Colleague? #Jan 11 How to install PuTTY on a MacOS?
You might also like these
Forcing the domain to serve securely using HTTPSMiscellaneousCreate a galley with overlapping images using CSS gridCSSCreate dynamic selectors using SCSS (Sass)SCSSHow SCSS (Sass) finds a module without a file extension?SCSSIN and BETWEEN Operators in SQLSQL/MySQLWP_Query Class in WordPressWordPressThe 7 Security Objectives of Any Organization for IT and Network SecurityMiscellaneousHow to invalidate all existing cookies using Security Keys in WordPress?WordPressThe 8 Golden Rules of Programming I Have Learned in My CareerMiscellaneousA complete guide to add responsive YouTube videos using HTML and CSSCSSHow to Block IPs and User Agents using code in Drupal or WordPress?DrupalWordPress: How to query all posts from custom post type and display them in a list?WordPress