+ 3

What's the best use of double and float in java ?

I am confused when using double and float

3rd Jul 2018, 7:03 AM
Prince Raj
2 Respostas
+ 8
The float data type can hold four bytes of memory (32 bits), and store about 7 digits. Float is useful when you have large arrays of floating-point (decimal) numbers. This helps save some memory for these processes. Therefore a number like 3.14159265359 would most likely get rounded to 3.141593. In Java, you can express the number literally, or in scientific notation (e.g. 1.99E02). A double data type can hold 8 bytes (64 bits), and store about 15 digits after the decimal point. It is almost double the float, and so we often say that a float is single-point precision, and a double is double-point precision. But remember the issue with precision in float. The same thing happens with a double; things will get rounded/truncated after a certain value. from: https://study.com/academy/lesson/java-float-vs-double.html
3rd Jul 2018, 8:22 AM
Agent
Agent - avatar
0
Thank you
21st Jul 2020, 8:12 AM
GV,Yuvan music தமிழ்
GV,Yuvan music தமிழ் - avatar