The Wikipedia page on it is a good place to start.

To sum up:

  • float is represented in 32 bits, with 1 sign bit, 8 bits of exponent, and 23 bits of the significand (or what follows from a scientific-notation number: 2.33728*1012; 33728 is the significand).

  • double is represented in 64 bits, with 1 sign bit, 11 bits of exponent, and 52 bits of significand.

By default, Java uses double to represent its floating-point numerals (so a literal 3.14 is typed double). It's also the data type that will give you a much larger number range, so I would strongly encourage its use over float.

There may be certain libraries that actually force your usage of float, but in general - unless you can guarantee that your result will be small enough to fit in float's prescribed range, then it's best to opt with double.

If you require accuracy - for instance, you can't have a decimal value that is inaccurate (like 1/10 + 2/10), or you're doing anything with currency (for example, representing $10.33 in the system), then use a BigDecimal, which can support an arbitrary amount of precision and handle situations like that elegantly.

Answer from Makoto on Stack Overflow
🌐
DataCamp
datacamp.com › doc › java › float
float Keyword in Java: Usage & Examples
The float keyword in Java is a primitive data type that represents a single-precision 32-bit IEEE 754 floating point.
🌐
Study.com
study.com › business courses › java programming tutorial & training
Java: Floating Point Numbers - Lesson | Study.com
October 3, 2018 - Floating point numbers are also called floating point literals in Java. For calculations using decimal values, Java supports two basic data types: float and double. Together, these support decimal or floating point numbers in the Java programming ...
Discussions

ELI5:Java. Could someone explain what the data type 'float' is and how/why it should be used? Thanks
Basically floats are numbers which are stored with a fractional, or decimal part. For example, if you write: int myInt = 5.23; float myFloat = 5.23; System.out.println(myInt); System.out.println(myFloat); You will see the output: 5 5.23 Because the figures after the decimal point were not stored in the int type variable. Edit: Sorry for the bad formatting... Apparantly I don't know how to line break on reddit. Double Edit: Nevermind, figured it out More on reddit.com
🌐 r/explainlikeimfive
7
0
November 22, 2013
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
[New CS Student]Trouble differentiating between floats and doubles--why is 23.5 considered a double?
Every decimal number literal will be considered a double by default unless specified as float with the f. Same goes for whole numbers being integers by default. More on reddit.com
🌐 r/learnjava
7
5
August 7, 2021
🌐
Oracle
docs.oracle.com › javase › tutorial › java › nutsandbolts › datatypes.html
Primitive Data Types (The Java™ Tutorials > Learning the Java Language > Language Basics)
The signed long has a minimum value ... etc to support arithmetic operations for unsigned long. float: The float data type is a single-precision 32-bit IEEE 754 floating point....
🌐
iO Flood
ioflood.com › blog › java-float
Java Float Keyword Explained: Usage and Examples
February 26, 2024 - This is because Java interprets decimal numbers as double by default. The ‘f’ suffix tells Java that this is a float, not a double. This basic understanding of float will help you navigate more complex scenarios as we move to more advanced topics. Java’s float data type is not limited to just storing decimal numbers.
🌐
Medium
tarunjain07.medium.com › java-datatypes-notes-8e70959f4898
float datatypes in Java— [Notes]. **WIP | by Tarun Jain | Medium
September 5, 2022 - The double data type is usually the default for decimal values. ... The float data type stores a decimal value with a precision of 6–7 digits.
🌐
W3Schools
w3schools.com › java › ref_keyword_float.asp
Java float Keyword
The float keyword is a data type that can store fractional numbers from 3.4e−038 to 3.4e+038.
Find elsewhere
🌐
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?
Java’s float and double data types are the only two floating point primitive types in the API.
Published: May 23, 2026
🌐
W3Schools
w3schools.com › java › java_data_types.asp
Java Data Types
Primitive data types - includes byte, short, int, long, float, double, boolean and char · Non-primitive data types - such as String, Arrays and Classes (you will learn more about these in a later chapter) A primitive data type specifies the type of a variable and the kind of values it can hold. There are eight primitive data types in Java: Once a variable is declared with a type, it cannot change to another type later in the program: int myNum = 5; // myNum is an int // myNum = "Hello"; // Error: cannot assign a String to an int String myText = "Hi"; // myText is a String // myText = 123; // Error: cannot assign a number to a String ·
🌐
O'Reilly
oreilly.com › library › view › java-for-dummies › 9781118239742 › a44.html
Floating-point Data Types - Java For Dummies Quick Reference [Book]
June 5, 2012 - Java has two primitive types for floating-point numbers: ... In almost all cases, you should use the double type whenever you need numbers with fractional values.
Author: Doug Lowe
Published: 2012
Pages: 288
🌐
Software Testing Help
softwaretestinghelp.com › home › java › java float tutorial with programming examples
Java Float Tutorial With Programming Examples
April 1, 2025 - Enlisted below are the details about float and double type. The range is approximate. As you can clearly see, the float is smaller and has a lesser range than Java double. In this tutorial, we will discuss the Float data type in detail.
🌐
Javatpoint
javatpoint.com › float-keyword-in-java
Java float keyword - Javatpoint
Java float keyword - The Java float keyword is a primitive data type. It is a single-precision 32-bit IEEE 754 floating point. It is used to declare the variables and methods. It represents the fractional numbers.
🌐
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 - 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 (Standard for Floating-Point Arithmetic) floating-point number, that is it can allow up to 6 digits precision after the decimal.
🌐
Medium
medium.com › @t.dasanthaedirisinghe › understanding-javas-int-float-and-boolean-data-types-1b7b6cb6609
Understanding Java’s int, float, and boolean Data Types | by T_DasanthaEdirisinghe | Medium
April 14, 2023 - When deciding which data type to use, it is important to consider the precision of the floating-point number. Double variables have a precision of about 15 digits, while the precision of float is only six or seven decimal digits. Therefore, it is generally safer to use double for most calculations. A floating-point number can also be a scientific number with an ‘e’ to indicate the power of 10. ... In Java, the boolean data type is used to represent a logical value, which can be either true or false.
🌐
freeCodeCamp
freecodecamp.org › news › data-types-in-java
Data Types in Java
January 26, 2020 - Wrapper Class: Float Float is mainly used to save memory in large arrays of floating point numbers. Default value: 0.0f. Example: float f1 = 24.5f; The default data type of floating-point number is double. So float f = 24.5 will introduce an error.
🌐
LabEx
labex.io › tutorials › java-how-to-declare-a-float-variable-in-java-415688
How to declare a float variable in Java | LabEx
It is one of the primitive data types in Java, along with int, double, boolean, and others. The float data type is useful for storing values that require a decimal point, such as measurements, scientific calculations, and financial data.
🌐
Medium
sunilkumar9633.medium.com › float-and-double-in-java-16508824459f
Float and Double in Java | by sunil kumar | Medium
August 22, 2026 - The Float data type is a single-precision 32-bit IEEE 754 Floating point which is used to represent Floating point numbers in Java. The default value of Float is 0.0f. The Float is 32 bits of storage and has a range of 3 .4e–038 to 3.4e+038.
🌐
Medium
medium.com › @gauravshah97 › working-with-java-datatypes-fd8f333fcd24
Working with Java Datatypes. In this tutorial, we delve into the… | by Gaurav Shah | Medium
April 26, 2024 - Float Data Type The float data type is a single-precision 32-bit IEEE 754 floating-point. Use a float (instead of double) if you need to save memory in large arrays of floating-point numbers.