The biggest/largest integer that can be stored in a double without losing precision is the same as the largest possible value of a double. That is, DBL_MAX or approximately 1.8 × 10308 (if your double is an IEEE 754 64-bit double). It's an integer, and it's represented exactly.

What you might want to know instead is what the largest integer is, such that it and all smaller integers can be stored in IEEE 64-bit doubles without losing precision. An IEEE 64-bit double has 52 bits of mantissa, so it's 253 (and -253 on the negative side):

  • 253 + 1 cannot be stored, because the 1 at the start and the 1 at the end have too many zeros in between.
  • Anything less than 253 can be stored, with 52 bits explicitly stored in the mantissa, and then the exponent in effect giving you another one.
  • 253 obviously can be stored, since it's a small power of 2.

Or another way of looking at it: once the bias has been taken off the exponent, and ignoring the sign bit as irrelevant to the question, the value stored by a double is a power of 2, plus a 52-bit integer multiplied by 2exponent − 52. So with exponent 52 you can store all values from 252 through to 253 − 1. Then with exponent 53, the next number you can store after 253 is 253 + 1 × 253 − 52. So loss of precision first occurs with 253 + 1.

Answer from Steve Jessop on Stack Overflow
Top answer
1 of 11
733

The biggest/largest integer that can be stored in a double without losing precision is the same as the largest possible value of a double. That is, DBL_MAX or approximately 1.8 × 10308 (if your double is an IEEE 754 64-bit double). It's an integer, and it's represented exactly.

What you might want to know instead is what the largest integer is, such that it and all smaller integers can be stored in IEEE 64-bit doubles without losing precision. An IEEE 64-bit double has 52 bits of mantissa, so it's 253 (and -253 on the negative side):

  • 253 + 1 cannot be stored, because the 1 at the start and the 1 at the end have too many zeros in between.
  • Anything less than 253 can be stored, with 52 bits explicitly stored in the mantissa, and then the exponent in effect giving you another one.
  • 253 obviously can be stored, since it's a small power of 2.

Or another way of looking at it: once the bias has been taken off the exponent, and ignoring the sign bit as irrelevant to the question, the value stored by a double is a power of 2, plus a 52-bit integer multiplied by 2exponent − 52. So with exponent 52 you can store all values from 252 through to 253 − 1. Then with exponent 53, the next number you can store after 253 is 253 + 1 × 253 − 52. So loss of precision first occurs with 253 + 1.

2 of 11
113

9007199254740992 (that's 9,007,199,254,740,992 or 2^53) with no guarantees :)

Program

#include <math.h>
#include <stdio.h>

int main(void) {
  double dbl = 0; /* I started with 9007199254000000, a little less than 2^53 */
  while (dbl + 1 != dbl) dbl++;
  printf("%.0f\n", dbl - 1);
  printf("%.0f\n", dbl);
  printf("%.0f\n", dbl + 1);
  return 0;
}

Result

9007199254740991
9007199254740992
9007199254740992
🌐
Microsoft Learn
learn.microsoft.com › en-us › cpp › cpp › data-type-ranges
Data Type Ranges | Microsoft Learn
The ranges specified in the following table are inclusive-inclusive. A variable of __wchar_t designates either a wide-character type or multibyte-character type. Use the L prefix before a character or string constant to designate the wide-character-type constant. signed and unsigned are modifiers that you can use with any integral type except bool.
Discussions

Largest integer a long double can hold?
There are two potential answers here depending on what you want, and the size of long double can vary from platform to platform (I've seen both 64-bit and 80-bit long doubles), so here are the two options First, the absolute largest integer that a float of any kind can hold is that float's maximum (non-infinity) value (the exponent of the float is so large at that point that it's guaranteed to be an integer): std::numeric_limits::max() For a 64-bit long double this would likely be roughly 1.79769e+308, and for 80-bit it's likely 1.18973e+4932 However, there are a lot of integers from 0 to that number that are not fully representable, so what I assume you're actually asking for is "the largest integer a long double can hold while being able to represent all integers less than it" in which case the answer has to do with the number of bits in the mantissa: (1ull << std::numeric_limits::digits()) - 1 For a standard 64-bit long double this number is 9,007,199,254,740,991 (2 to the 53rd minus 1), and for an 80-bit long double it'd likely be 18,446,744,073,709,551,615 (2 to the 64th minus 1) (Edit: if you're doing this with 80-bit long doubles, the above math would technically fail because 1ull << 64 is undefined behavior, you'd want to special case check whether std::numeric_limits::digits() 64 and, if so, then your actual result is std::numeric_limits::max() (which is 264 - 1) Edit: accidentally wrote "2 to the 54th minus 1" instead of "2 to the 53rd minus 1", fixed More on reddit.com
🌐 r/cpp
35
14
February 6, 2025
c++ - Range of decimal, double, integer, etc. data types? - Stack Overflow
XML and RDF data has certain data types like decimal, double and integer (http://www.w3.org/TR/1999/WD-xmlschema-2-19991217/#decimal). What are the range of these data types. I know that the range... More on stackoverflow.com
🌐 stackoverflow.com
May 22, 2017
What are the actual ranges of floating point and double data types in C#? - Stack Overflow
I'm learning C# and trying to get a logical visual representation of the actual range of data types in C#. I have moved through the integers and am now up to float and double data types. 8 bits (1 More on stackoverflow.com
🌐 stackoverflow.com
c - Representing integers in doubles - Stack Overflow
Can a double (of a given number of bytes, with a reasonable mantissa/exponent balance) always fully precisely hold the range of an unsigned integer of half that number of bytes? E.g. can an eight ... More on stackoverflow.com
🌐 stackoverflow.com

The biggest/largest integer that can be stored in a double without losing precision is the same as the largest possible value of a double. That is, DBL_MAX or approximately 1.8 × 10308 (if your double is an IEEE 754 64-bit double). It's an integer, and it's represented exactly.

What you might want to know instead is what the largest integer is, such that it and all smaller integers can be stored in IEEE 64-bit doubles without losing precision. An IEEE 64-bit double has 52 bits of mantissa, so it's 253 (and -253 on the negative side):

  • 253 + 1 cannot be stored, because the 1 at the start and the 1 at the end have too many zeros in between.
  • Anything less than 253 can be stored, with 52 bits explicitly stored in the mantissa, and then the exponent in effect giving you another one.
  • 253 obviously can be stored, since it's a small power of 2.

Or another way of looking at it: once the bias has been taken off the exponent, and ignoring the sign bit as irrelevant to the question, the value stored by a double is a power of 2, plus a 52-bit integer multiplied by 2exponent − 52. So with exponent 52 you can store all values from 252 through to 253 − 1. Then with exponent 53, the next number you can store after 253 is 253 + 1 × 253 − 52. So loss of precision first occurs with 253 + 1.

Answer from Steve Jessop on Stack Overflow
🌐
DaniWeb
daniweb.com › programming › software-development › threads › 75943 › range-of-a-double-integer-in-c
Range of a double integer in C++ | DaniWeb
April 20, 2007 - What actually I want to do with the program is, get an output in double data type not double integer. As I mentioned earlier the double data type can store any value with a between the acceptable range of 2.2e-308 to 1.8e308.
🌐
Wikipedia
en.wikipedia.org › wiki › Double-precision_floating-point_format
Double-precision floating-point format - Wikipedia
1 month ago - Double-precision binary floating-point ... wider range over single-precision floating point, in spite of its performance and bandwidth cost. It is commonly known simply as double. The IEEE 754 standard specifies a binary64 as having: ... The sign bit determines the sign of the number (including when this number is zero, which is signed). The exponent field is an 11-bit unsigned integer from 0 to ...
🌐
Oracle
docs.oracle.com › javadb › 10.10.1.2 › ref › rrefsqljdoubleprecision.html
DOUBLE PRECISION data type
The DOUBLE PRECISION data type provides 8-byte storage for numbers using IEEE floating-point notation.
🌐
inriver community
community.inriver.com › hc › en-us › articles › 360018781134-Max-amount-of-numbers-allowed-in-a-field-with-field-type-double-integer
Max amount of numbers allowed in a field with field type double, integer – inriver community
July 8, 2021 - These are standard definitions for these types of fields. Integer has a maximum value of 2,147,483,647 (and down to negative -2,147,483,647). A double can handle values up to 1.8 × 10^308.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › c language › data-types-in-c
Data Types in C - GeeksforGeeks
Data types define memory allocation, value range, and valid operations on a variable. Understanding data types is essential for writing correct and efficient C programs. Data types in C are broadly classified into three categories: ... Primitive data types are the basic built-in data types in C used to store simple values like integers, characters, and floating-point numbers.
Published: 1 month ago
🌐
PostgreSQL
postgresql.org › docs › current › datatype-numeric.html
PostgreSQL: Documentation: 18: 8.1. Numeric Types
August 13, 2026 - On all currently supported platforms, the real type has a range of around 1E-37 to 1E+37 with a precision of at least 6 decimal digits. The double precision type has a range of around 1E-307 to 1E+308 with a precision of at least 15 digits. ...
🌐
GeeksforGeeks
geeksforgeeks.org › c++ › data-type-ranges-and-their-macros-in-c
Data Type Ranges and Their Macros in C++ - GeeksforGeeks
June 13, 2026 - Integer type limits are defined in the <climits> header. Floating-point type limits are defined in the <cfloat> header. These macros help avoid hardcoding implementation-specific values. Example: The following program displays the ranges of several built-in data types using predefined macros ... #include <iostream> // for int, char macros #include <climits> // for float, double macros #include <cfloat> using namespace std; int main() { // Displaying ranges with the help of macros cout << "char ranges from: " << CHAR_MIN << " to " << CHAR_MAX << endl; cout << "\nshort int ranges from: " << SHRT_MIN << " to " << SHRT_MAX << endl; cout << "\nint ranges from: " << INT_MIN << " to " << INT_MAX << endl; cout << "\nlong int ranges from: " << LONG_MIN << " to " << LONG_MAX << endl; cout << "\nfloat ranges from: " << FLT_MIN << " to " << FLT_MAX << endl; return 0; }
🌐
Reddit
reddit.com › r/cpp › largest integer a long double can hold?
r/cpp on Reddit: Largest integer a long double can hold?
February 6, 2025 -

Alright so this might be a stupid question but i need some help. I'm learning how to write in C++ for a class that I'm taking and I need to validate the data that a user could put in. I need to make sure it can take any number (decimal or integer) but not any string or other char. If this might work, I just want to know how large of an integer can be put into a long double. My idea is to use a loop to get it work and I want to use a long double for the decision statement so that the user could input valid info if they put something wrong. If there is a better way to do this, please let me know, but I am still only learning out so I ask that you're patient with me please.

Edit: Thank you all so much for the help, I'm only 3 weeks into this course and technically should not have learned loops or if else statements yet. I'm a little confused on the answers but Ill continue to try and figure them out. What I am specifically looking for is which what is the largest form of whole number that can be stored in a float that can also use any and all numbers before it. Like if 1 million was that largest a float could hold for integers, and I want to use 999,999 or 999,998 etc. etc. I'm using code blocks for anyone wondering since I've seen comments saying that the answer might vary depending on what I'm coding on

Top answer
1 of 12
44
There are two potential answers here depending on what you want, and the size of long double can vary from platform to platform (I've seen both 64-bit and 80-bit long doubles), so here are the two options First, the absolute largest integer that a float of any kind can hold is that float's maximum (non-infinity) value (the exponent of the float is so large at that point that it's guaranteed to be an integer): std::numeric_limits::max() For a 64-bit long double this would likely be roughly 1.79769e+308, and for 80-bit it's likely 1.18973e+4932 However, there are a lot of integers from 0 to that number that are not fully representable, so what I assume you're actually asking for is "the largest integer a long double can hold while being able to represent all integers less than it" in which case the answer has to do with the number of bits in the mantissa: (1ull << std::numeric_limits::digits()) - 1 For a standard 64-bit long double this number is 9,007,199,254,740,991 (2 to the 53rd minus 1), and for an 80-bit long double it'd likely be 18,446,744,073,709,551,615 (2 to the 64th minus 1) (Edit: if you're doing this with 80-bit long doubles, the above math would technically fail because 1ull << 64 is undefined behavior, you'd want to special case check whether std::numeric_limits::digits() 64 and, if so, then your actual result is std::numeric_limits::max() (which is 264 - 1) Edit: accidentally wrote "2 to the 54th minus 1" instead of "2 to the 53rd minus 1", fixed
2 of 12
15
https://en.cppreference.com/w/cpp/types/numeric_limits
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › visual-basic › language-reference › data-types › double-data-type
Double Data Type - Visual Basic | Microsoft Learn
September 15, 2021 - Holds signed IEEE 64-bit (8-byte) ... value from -1.79769313486231570E+308 through -4.94065645841246544E-324 for negative values and from 4.94065645841246544E-324 through 1.79769313486231570E+308 for positive values....
🌐
University of Auckland
cs.auckland.ac.nz › references › unix › digital › AQTLTBTE › DOCU_031.HTM
Data Sizes
An object of a given data type is stored in a section of memory having a discreet size. Objects of different data types require different amounts of memory. Table 3-2 shows the size and range of the basic data types.
🌐
Quora
quora.com › What-is-the-range-of-numbers-that-an-integer-double-or-float-can-hold-What-if-I-want-to-store-bigger-values
What is the range of numbers that an integer, double or float can hold? What if I want to store bigger values? - Quora
Answer (1 of 3): It totally depends on the target processor and the compiler. And even the programming language — you didn’t say so I am just assuming C. For C/C++ the maximum and minimum values for all integer types are defined in the header file limits.h. For the floating point types ...
🌐
Luc
introcs.cs.luc.edu › data › types-and-conversions.html
Value Types and Conversions — Introduction to Computer Science in C# (09 May 2026)
If all the integers have even more limited ranges, they might be stored in the smaller space of a short or a byte. We will not further discuss or use types short or byte in this book. Here we will only use the integral types int and long. A double is also a value type, stored in a fixed-size space.
🌐
Baeldung
baeldung.com › home › java › java numbers › check if a double is an integer in java
Check if a double Is an Integer in Java | Baeldung
January 25, 2024 - One common scenario arises when we need to check whether a double is, in fact, a mathematical integer. In this tutorial, we’ll explore the various techniques available to perform this check, ensuring accuracy and flexibility in our numeric evaluations. First, as we know, a double is a floating-point data type that can represent fractional values and has a broader range than Java int or Integer.
🌐
CodeGym
codegym.cc › java blog › java numbers › how to convert int to double in java
How to convert int to double in Java
October 11, 2023 - The range of int numbers is from -231 to 231 - 1 or, which is the same, from -2147483648 to 2147483647. Double type in Java represents floating-point numbers, allocates 64 bits in memory and the range of the type is -1.7*10308 to 1.7*10308.