Excerpt from the C99 standard, normative annex F (The C++-standard does not explicitly mention this annex, though it includes all affected functions without change per reference. Also, the types have to match for compatibility.):

IEC 60559 floating-point arithmetic

F.1 Introduction

1 This annex specifies C language support for the IEC 60559 floating-point standard. The IEC 60559 floating-point standard is specifically Binary floating-point arithmetic for microprocessor systems, second edition (IEC 60559:1989), previously designated IEC 559:1989 and as IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE 754โˆ’1985). IEEE Standard for Radix-Independent Floating-Point Arithmetic (ANSI/IEEE 854โˆ’1987) generalizes the binary standard to remove dependencies on radix and word length. IEC 60559 generally refers to the floating-point standard, as in IEC 60559 operation, IEC 60559 format, etc. An implementation that defines __STDC_IEC_559__ shall conform to the specifications in this annex.356) Where a binding between the C language and IEC 60559 is indicated, the IEC 60559-specified behavior is adopted by reference, unless stated otherwise. Since negative and positive infinity are representable in IEC 60559 formats, all real numbers lie within the range of representable values.

So, include <math.h> (or in C++ maybe <cmath>), and test for __STDC_IEC_559__.

If the macro is defined, not only are the types better specified (float being 32bits and double being 64bits among others), but also the behavior of builtin operators and standard-functions is more specified.
Lack of the macro does not give any guarantees.

For x86 and x86_64 (amd64), you can rely on the types float and double being IEC-60559-conformant, though functions using them and operations on them might not be.

Answer from Deduplicator on Stack Overflow
Top answer
1 of 7
22

Excerpt from the C99 standard, normative annex F (The C++-standard does not explicitly mention this annex, though it includes all affected functions without change per reference. Also, the types have to match for compatibility.):

IEC 60559 floating-point arithmetic

F.1 Introduction

1 This annex specifies C language support for the IEC 60559 floating-point standard. The IEC 60559 floating-point standard is specifically Binary floating-point arithmetic for microprocessor systems, second edition (IEC 60559:1989), previously designated IEC 559:1989 and as IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE 754โˆ’1985). IEEE Standard for Radix-Independent Floating-Point Arithmetic (ANSI/IEEE 854โˆ’1987) generalizes the binary standard to remove dependencies on radix and word length. IEC 60559 generally refers to the floating-point standard, as in IEC 60559 operation, IEC 60559 format, etc. An implementation that defines __STDC_IEC_559__ shall conform to the specifications in this annex.356) Where a binding between the C language and IEC 60559 is indicated, the IEC 60559-specified behavior is adopted by reference, unless stated otherwise. Since negative and positive infinity are representable in IEC 60559 formats, all real numbers lie within the range of representable values.

So, include <math.h> (or in C++ maybe <cmath>), and test for __STDC_IEC_559__.

If the macro is defined, not only are the types better specified (float being 32bits and double being 64bits among others), but also the behavior of builtin operators and standard-functions is more specified.
Lack of the macro does not give any guarantees.

For x86 and x86_64 (amd64), you can rely on the types float and double being IEC-60559-conformant, though functions using them and operations on them might not be.

2 of 7
14

Does not say anything about the size.

3.9.1.8

There are three floating point types: float, double, and long double. The type double provides at least as much precision as float, and the type long double provides at least as much precision as double. The set of values of the type float is a subset of the set of values of the type double; the set of values of the type double is a subset of the set of values of the type long double. The value representation of floating-point types is implementation-defined. Integral and floating types are collectively called arithmetic types. Specializations of the standard template std::numeric_limits (18.3) shall specify the maximum and minimum values of each arithmetic type for an implementation.

๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ c-program-to-find-the-size-of-int-float-double-and-char
C Program to Find the Size of int, float, double and char - GeeksforGeeks
July 23, 2025 - Size of int is: 4 bytes Size of float is: 4 bytes Size of double is: 8 bytes Size of char is: 1 bytes ... In C, when you increment or decrement a pointer, the address changes based on the size of the data type it points to, not just by 1.
People also ask

Can I perform arithmetic operations on double with integer types in C?
Yes, you can perform arithmetic operations between double and integer types. The integer will be automatically promoted to a double for the operation.
๐ŸŒ
upgrad.com
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ double in c
Everything You Need to Know About the Double Data Type in C
What happens when you assign a double value to an int in C?
When assigning a double to an int, the fractional part of the double is truncated (not rounded) and only the integer part is stored.
๐ŸŒ
upgrad.com
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ double in c
Everything You Need to Know About the Double Data Type in C
How do double values behave in different systems or compilers?
While the C standard defines how double should behave, the actual representation and precision may vary slightly between different systems, compilers, and floating-point hardware.
๐ŸŒ
upgrad.com
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ double in c
Everything You Need to Know About the Double Data Type in C
๐ŸŒ
W3Schools
w3schools.com โ€บ c โ€บ c_data_types_sizeof.php
C sizeof operator
The memory size refers to how much space a type occupies in the computer's memory. To actually get the size (in bytes) of a data type or variable, use the sizeof operator: int myInt; float myFloat; double myDouble; char myChar; printf("%zu\n", sizeof(myInt)); printf("%zu\n", sizeof(myFloat)); printf("%zu\n", sizeof(myDouble)); printf("%zu\n", sizeof(myChar)); Try it Yourself ยป ยท
๐ŸŒ
Programiz
programiz.com โ€บ c-programming โ€บ examples โ€บ sizeof-operator-example
C Program to Find the Size of int, float, double and char
The sizeof(variable) operator computes the size of a variable. And, to print the result returned by sizeof, we use either %lu or %zu format specifier. #include<stdio.h> int main() { int intType; float floatType; double doubleType; char charType; // sizeof evaluates the size of a variable printf("Size of int: %zu bytes\n", sizeof(intType)); printf("Size of float: %zu bytes\n", sizeof(floatType)); printf("Size of double: %zu bytes\n", sizeof(doubleType)); printf("Size of char: %zu byte\n", sizeof(charType)); return 0; }
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ sizeof-operator-c
sizeof operator in C - GeeksforGeeks
The final result will be double, Hence the output of our program is 8 bytes. sizeof() is a compile-time operator. compile time refers to the time at which the source code is converted to a binary code. It doesn't execute (run) the code inside ().
Published ย  October 17, 2025
๐ŸŒ
Vultr
docs.vultr.com โ€บ clang โ€บ examples โ€บ find-the-size-of-int-float-double-and-char
C Program to Find the Size of int, float, double and char | Vultr Docs
September 27, 2024 - Here, the size of a double variable in bytes is printed. double typically requires more memory than float. Declare a char variable. Use the sizeof operator to check its size.
๐ŸŒ
Upgrad
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ double in c
Everything You Need to Know About the Double Data Type in C
February 27, 2025 - Explanation: This program prints the size of common data types. The sizeof(double) returns the size of the double data type, which is typically 8 bytes. ... This program converts a length in feet to meters using the double data type for precision.
Find elsewhere
Top answer
1 of 4
5

How to guarantee exact size of double in C?

Use _Static_assert()

#include <limits.h>

int main(void) {
  _Static_assert(sizeof (double)*CHAR_BIT == 64, "Unexpected double size");
  return 0;
}

_Static_assert available since C11. Otherwise code could use a run-time assert.

#include <assert.h>
#include <limits.h>

int main(void) {
  assert(sizeof (double)*CHAR_BIT == 64);
  return 0;
}

Although this will insure the size of a double is 64, it does not insure IEEE 754 double-precision binary floating-point format adherence.

Code could use __STDC_IEC_559__

An implementation that defines __STDC_IEC_559__ shall conform to the specifications in this annex` C11 Annex F IEC 60559 floating-point arithmetic

Yet that may be too strict. Many implementations adhere to most of that standard, yet still do no set the macro.


would there be some standard way to guarantee size of a floating point type or double?

The best guaranteed is to write the FP value as its hex representation or as an exponential with sufficient decimal digits. See Printf width specifier to maintain precision of floating-point value

2 of 4
3

The problem with floating point type is that the C standard doesn't specify how they should be represented. The use of IEEE 754 is not required.

If you're communicating between a system that uses IEEE 754 and one that doesn't, you won't be able to write on one and read on the other even if the sizes are the same.

You need to serialize the data in a known format. You can either use sprintf to convert it to a text format, or you can do some math to determine the base and mantissa and store those.

๐ŸŒ
TutorialKart
tutorialkart.com โ€บ c-programming โ€บ c-double-data-type
C double Data Type - Storage Size, Examples, Min and Max Values
February 20, 2025 - We can determine the storage size of double in bytes using the sizeof operator.
๐ŸŒ
BeginnersBook
beginnersbook.com โ€บ 2017 โ€บ 09 โ€บ c-program-to-find-the-size-of-int-float-double-and-char
C Program to find the Size of int, float, double and char
#include<stdio.h> int main() { printf("Size of char: %ld byte\n",sizeof(char)); printf("Size of int: %ld bytes\n",sizeof(int)); printf("Size of float: %ld bytes\n",sizeof(float)); printf("Size of double: %ld bytes", sizeof(double)); return 0; }
๐ŸŒ
Log2Base2
log2base2.com โ€บ C โ€บ operator โ€บ sizeof-operator-in-c.html
sizeof operator in c
double allocates 8 bytes to store the value. ... #include<stdio.h> int main() { printf("sizeof(int) = %d\n",sizeof(int)); printf("sizeof(char) = %d\n",sizeof(char)); printf("sizeof(float) = %d\n",sizeof(float)); printf("sizeof(double) = %d\n",sizeof(double)); return 0; } Run it
๐ŸŒ
Tutorial Gateway
tutorialgateway.org โ€บ c-program-to-find-the-size-of-int-float-double-and-char
C Program to find the size of int float double and char
April 5, 2025 - #include <stdio.h> int main() { printf("Size of a Character = %ld Byte", sizeof(char)); printf("\nSize of an Integer = %ld Byte", sizeof(int)); printf("\nSize of a Float = %ld Byte", sizeof(float)); printf("\nSize of a Double = %ld Byte\n", sizeof(double)); return 0; }
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ sizeof() in c
sizeof() in C - Scaler Topics
January 12, 2024 - We can use the sizeof() in C to dynamically allocate memory. Letโ€™s say we want to allocate the memory to accommodate 10 doubles and we donโ€™t know the size of the double in that machine, we can use the sizeof() operator in this case.
๐ŸŒ
Quora
quora.com โ€บ What-is-the-size-of-long-double-in-C-programming
What is the size of long double in C programming? - Quora
Answer (1 of 5): It depends on the compiler and the processor. On the ARM 64-bit architecture, long double is defined as the IEEE quad precision standard (128-bit), but that does not mean that the C compiler actually supports it.
๐ŸŒ
DEV Community
dev.to โ€บ 0xog_pg โ€บ under-the-hood-the-importance-of-sizeof-in-c-and-c-3hc4
Under the hood: The Importance of sizeof in C and C++ - DEV Community
July 15, 2023 - So when we create call sizeof on arr, it returns 8 (the size of the pointer) and the size of arr[0] is 8 (double), this yields (2 * (8/8)) which gives 2, that's why the new array only has two elements.
๐ŸŒ
Programiz
programiz.com โ€บ c-programming โ€บ c-data-types
C Data Types
You can always check the size of a variable using the sizeof() operator. #include <stdio.h> int main() { short a; long b; long long c; long double d; printf("size of short = %d bytes\n", sizeof(a)); printf("size of long = %d bytes\n", sizeof(b)); printf("size of long long = %d bytes\n", sizeof(c)); printf("size of long double= %d bytes\n", sizeof(d)); return 0; }
๐ŸŒ
Arduino Forum
forum.arduino.cc โ€บ forum 2005-2010 (read only) โ€บ software โ€บ bugs & suggestions
sizeof(double)? - Bugs & Suggestions - Arduino Forum
April 9, 2008 - The documentation says that the size of a double is 8 bytes (http://www.arduino.cc/en/Reference/Double) but I find that in a C program, sizeof(double) returns 4. Is the documentation in error? Joe
๐ŸŒ
Medium
medium.com โ€บ @Dev_Frank โ€บ datatypes-in-c-double-long-double-void-bool-0e55eaec1380
DATATYPES IN C (double, long double, void, bool) | by Dev Frank | Medium
February 5, 2024 - It can vary, but itโ€™s often 8 bytes or more. To declare a long double variable, you use the following syntax: ... long double variables support standard arithmetic operations, including addition, subtraction, multiplication, and division, ...
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ what is double in c?
What is Double in C? - Scaler Topics
April 28, 2024 - In this section, we will see a few programs that involve the use of double in C. Choose from our industry-leading programs designed for career success ... The sizeof() function can be used to determine the size of different data types in c.