Doubles and floats in most programming languages are more complicated than that. You can find a more technical explanation by looking up the IEEE 754 standard for floating point numbers.

Basically, floating point numbers (in java, the variable types float and double) are effectively stored in scientific notation, with a sign, mantissa, and exponent. (The base for the exponent is always 2). How this is converted into binary format is a bit complicated, but the important part to know is that the numbers are effectively stored as +/- mantissa * 2^exponent.

The mantissa and exponent, however, both have fixed ranges. What your textbook is talking about is the range of values that are possible based on the range of the exponent. That is, how large or small can values be if you choose the largest or smallest possible exponent, ignoring the sign of the value. Zero is also ignored for this case, because in scientific notation, zero is a trivial case which does not illustrate the available range of exponents.

Doubles have about 15-16 digits worth of precision, that is, you can represent numbers with a mantissa of length 15-16 digits, regardless of the exponent. Regardless of the mantissa, you can represent numbers ranging from about 10^-324 to about 10^308. And regardless of the mantissa and exponent, you can represent both positive and negative values.

Answer from zstewart on Stack Overflow
Top answer
1 of 2
3

Doubles and floats in most programming languages are more complicated than that. You can find a more technical explanation by looking up the IEEE 754 standard for floating point numbers.

Basically, floating point numbers (in java, the variable types float and double) are effectively stored in scientific notation, with a sign, mantissa, and exponent. (The base for the exponent is always 2). How this is converted into binary format is a bit complicated, but the important part to know is that the numbers are effectively stored as +/- mantissa * 2^exponent.

The mantissa and exponent, however, both have fixed ranges. What your textbook is talking about is the range of values that are possible based on the range of the exponent. That is, how large or small can values be if you choose the largest or smallest possible exponent, ignoring the sign of the value. Zero is also ignored for this case, because in scientific notation, zero is a trivial case which does not illustrate the available range of exponents.

Doubles have about 15-16 digits worth of precision, that is, you can represent numbers with a mantissa of length 15-16 digits, regardless of the exponent. Regardless of the mantissa, you can represent numbers ranging from about 10^-324 to about 10^308. And regardless of the mantissa and exponent, you can represent both positive and negative values.

2 of 2
1

I think you're interpreting the range in a mathematical sense. What your book means by range is how small of a finite number and how large of a finite number Double can produce, both for negative and positive values. So basically how close it can get to 0 with finite values and how close it can get to infinite with finite values. The actual range in a mathematical sense of Double is something like -1.7*10^308 to 1.7*10^308.

The Double class has members which contain it's Min and Max value. Take a look at Min_VALUE and Max_VALUE members for Double. Really the mathematical range is a byproduct of the range in your book ([-Double.MAX_VALUE, Double.MAX_VALUE]) , which is a result of how many degrees of accuracy Double can hold.

🌐
Dot Net Perls
dotnetperls.com › double-java
Java - double Number - Dot Net Perls
In Java a double is twice the size of a float—it is 8 bytes (which is equal to 64 bits).
Discussions

Which is larger? Long vs Double
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/javahelp
10
3
January 19, 2023
When should I use double and when should I use float for Java?
On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge. If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options: Limiting your involvement with Reddit, or Temporarily refraining from using Reddit Cancelling your subscription of Reddit Premium as a way to voice your protest. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/learnprogramming
65
59
January 6, 2024
Newbie: why would you use int over double ever?
Doubles can be imprecise due to floating point rounding errors. For example, you would never use doubles if you were writing banking software that handles money. For example, try computing 1.89 * 792 in Java. Mathematically, you should get 1496.88 as the result. However, because of rounding errors, the value that Java (and other languages) produce is 1496.8799999999999. It's very close to 1496.88, but it's not exactly that amount. If you keep performing computations, the error will only increase in range, and then suddenly you're left wondering why your answers are off by 1 or 2, even when there is nothing wrong with the operations mathematically. More on reddit.com
🌐 r/javahelp
12
1
August 2, 2015
float vs. double – What's the Key Difference?"
It can depend on the language spec, but usually the amount of memory and therefore the precision allowed by the type. Usually: A double will use 8 bytes or 64 bits of memory while a float uses only 4 bytes or 32 bits. This means that a float is less precise since it can store fewer digits after the decimal place. The way it works is that some bits of the datatype are used for the whole number portion of the number and some for the decimal portion. So as you can see, double, using more memory can have more bits allocated to the decimal portion making it more precise. See balefrost's reply to my comment for a correct explanation of this. Using float means using less memory, having more efficient code (due to lower precision so saving on calculations) and handling a smaller range of numbers (floats handle a smaller range than double due to reduced memory usage). Hope this helps! More on reddit.com
🌐 r/learnprogramming
12
16
November 2, 2024
🌐
TutorialsPoint
tutorialspoint.com › java-program-to-double-the-size-of-an-array
Java program to double the size of an array
July 2, 2024 - In this article, we will learn how to double the size of an array in Java. This involves creating a new array with twice the length of the original array and copying the elements from the original array to the new, larger array. Problem Statement Cre
🌐
Quora
quora.com › What-is-the-range-of-the-double-data-type-in-Java
What is the range of the double data type in Java? - Quora
Answer (1 of 4): The range of double in Java is 1.7976931348623157 x 10^308 to 4.9406564584124654 x 10^-324. The java documentation mentions all such details of different data types and all the classes, interfaces and function that are shipped ...
🌐
Baeldung
baeldung.com › home › java › java numbers › float vs. double in java
Float vs. Double in Java | Baeldung
January 4, 2025 - In contrast, a double is a 64-bit double-precision floating-point type, requiring eight bytes of memory. While it demands more storage, this larger size allows it to represent values with higher precision and a broader range, making it indispensable ...
🌐
Coderanch
coderanch.com › t › 389012 › java › Int-size-double-size
Int size and double size (Beginning Java forum at Coderanch)
June 22, 2001 - An int that is sized to hold 20 bytes can hold a number 46 digits long! So what I'm saying is that if you could have int type that you could mess with the size, when you get up to really large numbers it would be much more efficient. THe same goes for doubles.
🌐
W3Schools
w3schools.com › java › java_data_types.asp
Java Data Types
Note: This rule makes Java safer, because the compiler will stop you if you try to mix up types by mistake. If you really need to change between types, you must use type casting or conversion methods (for example, turning an int into a double).
🌐
Baeldung
baeldung.com › home › java › core java › introduction to java primitives
Introduction to Java Primitives | Baeldung
January 8, 2024 - The primitive data types have size limits. But what happens if we try to store a value that’s larger than the maximum value? We run into a situation called overflow. When an integer overflows, it rolls over to the minimum value and begins counting up from there. Floating point numbers overflow by returning Infinity: int i = Integer.MAX_VALUE; int j = i + 1; // j will roll over to -2_147_483_648 double d = Double.MAX_VALUE; double o = d + 1; // o will be Infinity
Find elsewhere
🌐
IBM
ibm.com › docs › en › i › 7.4.0
COBOL and Java Data Types
We cannot provide a description for this page right now
🌐
Geekster
geekster.in › home › data types java – primitive and non-primitive
Data Types Java - Primetive and Non-Primetive (with Example)
June 27, 2024 - The use of data types is crucial for ensuring data integrity and efficient memory usage in Java programs. • Primitive Data Types • Non-primitive Data Types · Integers This group includes byte, short, int, and long, which are for whole-valued signed numbers. Floating-point numbers – This group includes float and double, which represent numbers with fractional precision.
🌐
GeeksforGeeks
geeksforgeeks.org › java › java-data-types
Java Data Types - GeeksforGeeks
A 64-bit double-precision floating-point type and the default for decimal numbers. ... Size : 8 bytes (64 bits). It is recommended to go through rounding off errors in java.
Published   January 16, 2026
🌐
Quora
quora.com › In-Java-how-do-you-double-the-length-of-an-array
In Java how do you double the length of an array? - Quora
You can create a new array with twice the size of the existing one and copy over the elements of the existing array, preferably via System.arraycopy(). But tell me, how does a linked list have anything to do with an ar...
🌐
Oracle
docs.oracle.com › javase › tutorial › java › nutsandbolts › datatypes.html
Primitive Data Types (The Java™ Tutorials > Learning the Java Language > Language Basics)
This data type should never be ... and other useful classes provided by the Java platform. double: The double data type is a double-precision 64-bit IEEE 754 floating point....
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › Double.html
Double (Java Platform SE 8 )
October 20, 2025 - The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "double format" bit layout. If the argument is 0x7ff0000000000000L, the result is positive infinity. If the argument is 0xfff0000000000000L, the result is negative infinity. If the argument is any value in the range 0x7ff0000000000001L through 0x7fffffffffffffffL or in the range 0xfff0000000000001L through 0xffffffffffffffffL, the result is a NaN. No IEEE 754 floating-point operation provided by Java can distinguish between two NaN values of the same type with different bit patterns.
🌐
TheServerSide
theserverside.com › blog › Coffee-Talk-Java-News-Stories-and-Opinions › Float-vs-Double-Whats-the-difference
Java double vs float: What's the difference?
A double is twice the size of a float — thus the term double. In Java, the Float and Double wrapper classes have two properties that return the upper and lower limits of float and double data types, MIN_VALUE and MAX_VALUE:
🌐
DataCamp
datacamp.com › doc › java › double
double Keyword in Java: Usage & Examples
The range for double values is approximately from 4.9e-324 to 1.7e+308. ... public class DoubleExample { public static void main(String[] args) { double pi = 3.14159; double gravity = 9.81; System.out.println("Value of pi: " + pi); System.out.println("Value of gravity: " + gravity); } }
🌐
MIT
web.mit.edu › java_v1.0.2 › www › javadoc › java.lang.Double.html
Class java.lang.Double
Returns true if the specified number is infinitely large in magnitude. ... Returns true if this Double value is the special Not-a-Number (NaN) value.