Software-OK
≡... News | ... Home | ... FAQ | Impressum | Contact | Listed at | Thank you |

  
HOME ► Faq ► FAQ - Windows-CPP-und-C ► ««« »»»

What is the difference between float and double?


There are key differences between float and double, even though both are floating point numbers !




Contents:
1.) ... The difference between float and double!
2.) ... Technically and in more detail about float and double!

1.) The difference between float and double!

 The float value is a 32-bit number with floating point , the double variable is 64-bit or 80-bit long and therefore more precise.

Both variables are floating point numbers: ►►  What is a floating point number (floating point numbers)?

So double has extended precision, which refers to floating point number formats that provide higher precision than the basic floating point formats of the float variable.

 
A little hint!

Although double is larger, there is no loss of speed! On the contrary, on most CPUs/FPUs, using double instead of float makes the program faster. Unless there are large memory accesses (ARRAYS), then memory access comes into play, then working with float is faster, especially important for 3D programming or image editing.



(Image-1) float and double?
What is the difference between float and double?


-
▲ Back to the top ▲


2.) Technical and more detailed about float and double!



float and double are both data types used in programming languages, especially languages ​​like C, C++, Java and others. They are used to represent floating point numbers, i.e. numbers with a decimal point or a fraction. The main difference between them is their precision and the amount of memory they occupy:


Precision:

Float: A float is a single precision floating point number. Normally 32 bits are used to represent a number. This means that it can represent a wide range of values, but with limited accuracy. The precision is approximately 7 decimal places.
double: A double is a double precision floating point number. Normally 64 bits are used to represent a number. This allows a much larger range of values ​​to be represented with greater precision. The precision is approximately 15-16 decimal places.

Range:

Float:Because fewer bits are used, a float has a smaller range of representable values ​​compared to a double. It can represent numbers with a wide range of exponents but with fewer significant digits.

Double: Because of its larger number of bits, a double can represent a much larger range of values, including extremely large and small numbers, and maintain greater precision within that range.

Memory Usage:

Float:
A float typically requires 4 bytes (32 bits) of memory.
Double: A double typically requires 8 bytes (64 bits) of memory.

Use:
Use float when memory usage is an issue and you can tolerate lower precision. For example, in applications where memory is limited, such as embedded systems or mobile devices.

Use double when you need higher precision or when the range of values ​​you need to represent is large and memory usage is not a critical issue. For most general calculations on modern computers, “Double” is the default setting.


In summary, the choice between float and double depends on the specific needs of your program, including the precision required and the available memory. If precision and memory are not critical factors, Double is a safer choice due to higher precision and larger range, but uses more memory.



FAQ 10: Updated on: 9 October 2023 03:29 Windows
Windows-CPP-und-C

Reserve virtual memory C++, Windows?


The solution is very simple if you want to reserve virtual memory with C++ under Windows  Contents: 1. The program command to reserve virtual memory
Windows-CPP-und-C

Difference between IExtractImage2 and IExtractImage?


You want to implement IExtractImage or IExtractImage2 and register it as a Windows Shell extension Simply implement IExtractImage2, this is required to
Windows-CPP-und-C

Defender slows down the development of applications, programs and APPs!


It is in fact the case that the Defender greatly hinders the development of applications, programs and APPs, slows it down and is no fun to work with  
Windows-CPP-und-C

C++ query whether a string or char ends with a specific character?


The Solution is Simple: Checking if a String or Character Array Ends with a Certain Substring in C++ The provided C++ functions are designed to perform operations
Windows-CPP-und-C

Publish desktop applications in the MS Store using the Desktop Bridge!


It is easy to publish existing desktop applications in the MS Store using the Desktop Bridge Info: You can convert your existing desktop application into
Windows-CPP-und-C

Microsoft Visual Studio version overview, where can I find it?


The solution Microsoft Visual Studio version overview, where can I find it? In Arbeit Satz1=Microsoft Visual Studio version overview, where can I find it?
Windows-CPP-und-C

*.sdf file created from Visual Studio 10 onwards, what is it?


The SDF file is the so-called code browsing database that SQL Server Compact Edition uses If you search for the SDF on the Internet, you will see that it

»»

  My question is not there in the FAQ
Asked questions on this answer:
Keywords: windows, what, difference, between, float, double, there, differences, even, though, both, floating, point, numbers, contents, Questions, Answers, Software




  

  + Freeware
  + Order on the PC
  + File management
  + Automation
  + Office Tools
  + PC testing tools
  + Decoration and fun
  + Desktop-Clocks
  + Security

  + SoftwareOK Pages
  + Micro Staff
  + Freeware-1
  + Freeware-2
  + Freeware-3
  + FAQ
  + Downloads

  + Top
  + Desktop-OK
  + The Quad Explorer
  + Don't Sleep
  + Win-Scan-2-PDF
  + Quick-Text-Past
  + Print Folder Tree
  + Find Same Images
  + Experience-Index-OK
  + Font-View-OK


  + Freeware
  + AutoPowerOptionsOK
  + OneLoupe
  + TraceRouteOK
  + GetWindowText
  + AutoHideMouseCursor
  + Desktop.Calendar.Tray.OK
  + OK.Its.Raining.Men
  + Run-Command
  + MagicMouseTrails
  + PAD-s


Home | Thanks | Contact | Link me | FAQ | Settings | Windows 10 | gc24b | English-AV | Impressum | Translate | PayPal | PAD-s

 © 2025 by Nenad Hrg softwareok.de • softwareok.com • softwareok.com • softwareok.eu


► Hard disks, Hard drive? ◄
► What is bootable drive? ◄
► WINDOWS SETTING MS SETTINGS MAPS ◄
► WINDOWS SETTING MS SETTINGS DEVICEUSAGE ◄


This website does not store personal data. However, third-party providers are used to display ads,
which are managed by Google and comply with the IAB Transparency and Consent Framework (IAB-TCF).
The CMP ID is 300 and can be individually customized at the bottom of the page.
more Infos & Privacy Policy

....