C Programming - Declarations and Initializations - Discussion

Discussion Forum : Declarations and Initializations - General Questions (Q.No. 6)
6.
By default a real number is treated as a
float
double
long double
far double
Answer: Option
Explanation:

In computing, 'real number' often refers to non-complex floating-point numbers. It include both rational numbers, such as 42 and 3/4, and irrational numbers such as pi = 3.14159265...

When the accuracy of the floating point number is insufficient, we can use the double to define the number. The double is same as float but with longer precision and takes double space (8 bytes) than float.

To extend the precision further we can use long double which occupies 10 bytes of memory space.

Discussion:
50 comments Page 2 of 5.

Sundar said:   1 decade ago
Answer:

void main ()
{
float a=1.1;
if(a>1.1)
printf("welcome");
else
printf("bye");
getch();
}

Why the output is welcome please tell?

Float a=1.1 is considered float.

But, if (a>1. 1) there, 1.1 is real constant considered double. So, when using relation operators, type conversion accrued, the float convert to double, the padding accrued to value changed comparison time is not equal. Clearly you want, search about type conversion, how to changed the value in 0 1 padding time.

Jenifer said:   10 years ago
Difference between float and double? Does the space is the only difference? Any one please tell me.

Sangeethaj said:   10 years ago
This is a program very use get some knowledge how to programming compile what mean by "C" programming any important language send the email's.

Karthi said:   9 years ago
Here, float a=1.1 (1.100000), double b=1.1 (1.10000000).

So, a==b evaluates to false.

Rakripal said:   9 years ago
Very helpful notes. Thanks.

Jony_jony_yes_papa said:   1 decade ago
Why not long double?

Monu said:   9 years ago
Thanks for the explanation.

Kriti said:   9 years ago
Why it is not long double?

Jack said:   8 years ago
Long double is also the right one. Why to take only double?

Lavanya said:   8 years ago
Is there far double data type in c?


Post your comments here:

Your comments will be displayed after verification.