YogeshChauhan . com

What is the difference between float and double?

in Misc 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 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #4 How to uninstall Cocoapods from the Mac OS? #5 How to Use SQL MAX() Function with Dates? #6 PHP Login System using PDO Part 1: Create User Registration Page

Recently Posted

Jun 16 What are Stored Procedures for SQL Server? Jun 16 What are Class Constants in PHP? Jun 15 A short basic guide on states in React Jun 15 How to define constants in PHP? Jun 15 How to define visibility for a property in PHP? Jun 15 How to use @if and @else in SCSS?

You might also like these

The SELECT DISTINCT Statement in SQLSQL/MySQLFlash of Invisible Text and Mitt Romney Web Font ProblemCSSA simple example on grid ‘auto-fill’ vs ‘auto-fit’CSSReading Multiple Inputs in SwiftSwiftHow to import MySQL small sample database into phpMySQL?SQL/MySQLSolution to “Call to undefined function mysql_error()” in RevSlider WordPress PluginWordPressA quick introduction to API, REST API and PostmanMiscPHP Login System using PDO Part 2: Login using Email or UsernamePHPHow to remove special characters (dash, asterisk etc) from any string in PHP?PHPSequence generator (range) using JavaScript Array.from()JavaScriptCheck if mixin is being called in a style rule or not in SCSSSCSSHow to apply style only to first child and/or only to children other than the first child?CSS