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
🌐
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:
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.

🌐
Baeldung
baeldung.com › home › java › java numbers › float vs. double in java
Float vs. Double in Java | Baeldung
January 4, 2025 - Additionally, its smaller footprint can help minimize cache misses and boost performance in memory-intensive applications. In contrast, a double is a 64-bit double-precision floating-point type, requiring eight bytes of memory.
🌐
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).
🌐
W3Schools
w3schools.com › java › java_data_types.asp
Java Data Types
assert abstract boolean break byte case catch char class continue default do double else enum exports extends final finally float for if implements import instanceof int interface long module native new package private protected public return requires short static super switch synchronized this throw throws transient try var void volatile while Java String Methods
🌐
TutorialsPoint
tutorialspoint.com › java-program-to-double-the-size-of-an-array
Java program to double the size of an array
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
🌐
Coderanch
coderanch.com › t › 389012 › java › Int-size-double-size
Int size and double size (Beginning Java forum at Coderanch)
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.
Find elsewhere
Top answer
1 of 4
7

The absolute quantity of information that you can store in 64 bit is of course the same.

What changes is the meaning you assign to the bits.

In an integer or long variable, the codification used is the same you use for decimal numbers in your normal life, with the exception of the fact that number two complement is used, but this doesn't change that much, since it's only a trick to gain an additional number (while storing just one zero instead that a positive and a negative).

In a float or double variable, bits are split in two kinds: the mantissa and the exponent. This means that every double number is shaped like XXXXYYYYY where it's numerical value is something like XXXX*2^YYYY. Basically you decide to encode them in a different way, what you obtain is that you have the same amount of values but they are distribuited in a different way over the whole set of real numbers.

The fact that the largest/smallest value of a floating number is larger/smaller of the largest/smalles value of a integer number doesn't imply anything on the amount of data effectively stored.

2 of 4
2

A double can store a larger number by having larger intervals between the numbers it can store, essentially. Not every integer in the range of a double is representable by that double.

More specifically, a double has one bit (S) to store sign, 11 bits to store an exponent E, and 52 bits of precision, in what is called the mantissa (M).

For most numbers (There are some special cases), a double stores the number (-1)^S * (1 + (M * 2^{-52})) * 2^{E - 1023}, and as such, when E is large, changing M by one will make a much larger change in the size of the resulting number than one. These large gaps are what give doubles a larger range than longs.

🌐
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....
🌐
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 ...
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › lang › Double.html
Double (Java Platform SE 8 )
October 20, 2025 - Returns the smaller of two double values as if by calling Math.min. ... Java™ Platform Standard Ed.
🌐
Scaler
scaler.com › home › topics › float vs double in java - difference you should know
Float Vs Double in Java - Difference You Should Know - Scaler Topics
March 27, 2024 - Double is a 64-bit floating-point number, which means that it can store up to 15 decimal digits accurately. The float keyword in Java is a primitive data type, and its size limit is 4 byte or 32 bits (1 byte = 8 bits) single-precision IEEE 754 ...
🌐
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...
🌐
Coderanch
coderanch.com › t › 382983 › java › double-length-calculation
double length calculation (Java in General forum at Coderanch)
double value = 123456789123456789123456789.1234567890; DecimalFormat formatter = new DecimalFormat("####,####,####"); String str = formatter.format(value); int strLen = str.length(); It would be great, if any one help me to find out the format which can be used to calculate the length of the ...
🌐
Software Testing Help
softwaretestinghelp.com › home › java › java double – tutorial with programming examples
Java Double - Tutorial With Programming Examples
April 1, 2025 - In the below example, we have defined a pattern delimited by comma ‘,’ and a decimal number of type double. Using this pattern or format, we are going to display our input number. We have passed the pattern into the Decimal format class and we have formatted the output using the reference ‘df’. import java.text.DecimalFormat; public class ExampleFormat { public static void main(String[] args) { // defining a format in which number will be displayed String formatter = "##,###,###.##"; // initialized the decimal number double num = 12345678.12; // passed the pattern into the Decimal format class DecimalFormat df = new DecimalFormat(formatter); // printed the formatted number System.out.println("The formatted number is: " +df.format(num)); } }
🌐
MIT
web.mit.edu › java_v1.0.2 › www › javadoc › java.lang.Double.html
Class java.lang.Double
extends Number The Double class provides an object wrapper for Double data values and serves as a place for double-oriented operations. A wrapper is useful because most of Java's utility classes require the use of objects.
🌐
FavTutor
favtutor.com › blogs › java-float-vs-double
Java: Float vs Double | 4 Main Differences (& when to use?) | FavTutor
February 23, 2021 - So, here are 4 main differences between float and double in Java: Size: Float is of size 32 bits while double is of size 64 bits. Hence, double can handle much bigger fractional numbers than float.