Computer Science, asked by ayush12327, 1 year ago

which floating point type should be used to store digits of precision 15

Answers

Answered by abhishekkumar503030
3

Floating-point numbers are numbers that have fractional parts (usually expressed with a decimal point). You should use a floating-point type in Java programs whenever you need a number with a decimal, such as 19.95 or 3.1415.

Java has two primitive types for floating-point numbers:

float: Uses 4 bytes

double: Uses 8 bytes

In almost all cases, you should use the double type whenever you need numbers with fractional values.

The precision of a floating-point value indicates how many significant digits the value can have following its decimal point. The precision of a float type is only about six or seven decimal digits, which isn’t sufficient for most types of calculations.

If you use Java to write a payroll system, for example, you might get away with using float variables to store salaries for employees such as teachers or firefighters, but not for professional baseball players or corporate executives.

By contrast, double variables have a precision of about 15 digits, which is enough for most purposes.

Answered by Vanshika4721
1

hiii I will help you ✌️

=> In almost all cases, you should use the double type whenever you need numbers with fractional values. The precision of a floating-point value indicates how many significant digits the value can have following its decimal point.

Similar questions