Which data type is used for precise decimal calculations in C
Question
Which data type is used for precise decimal calculations in C
Solution
The data type used for precise decimal calculations in C is double. This data type is used when we need more precision compared to the float data type. It occupies 8 bytes of memory and provides a precision up to 15 to 16 decimal points.
Similar Questions
What Datatype do we use for Decimals?
answerThe long data type in C is often used for:OptionsSmall integersSingle-precision floating-point valuesLarge integersDouble-precision floating-point values
In C, a double data type is used to increase the accuracy of the real number wherever a float is not sufficient.A double data type occupies 8 bytes (64 bits) of memory to store real numbers, which have atleast one digit after the decimal point.A double data type can hold any value between 1.7E-308 to 1.7E+308.double data type values have a precision of 14 digits i.e., they can have 14 digits after the decimal point.Consider the following example using a double data type.#include <stdio.h>void main() { double num1 = 26.7368; double num2 = 1.42924; double total; total = num1 + num2; printf("Total of the given two numbers = %f\n", total);}Here, 8 bytes of memory is allocated to each variable num1, num2 and they are initialized with real number constants 26.7368 and 1.42924 respectively.Click on Live Demo to know about double data type in C.To further extend the precision of a double data type, the user can use long double data type. The long double type is guaranteed to have more bits than a double, while the exact number may vary from one hardware platform to another.A long double data type allocates 10 bytes(80 bits) of memory to store the given values.A long double data type can hold any value between 3.4E-4932 to 1.1E+4932.Select all the correct statements from the given statements.A double data type occupies 8 bytes of memory.A double data type can have up to 10 decimal places for the fractional part.A long double data type allocates 16 bytes of memory to the variables.A double data type uses 1 bit for sign, 10 bits for exponent value and 53 bits for mantissa part.
What is the size of the float data type in C?
Which of the following is not a basic data type in C language?a.floatb.intc.chard.realClear my choice
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.