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 3 of 5.

TAMIZHARASI said:   8 years ago
Thanks for the given explanation.

Mounika said:   8 years ago
Thanks for the given explanation.

Sai veena said:   7 years ago
Why we use long double for computing quadratic equations and why not floating point?

Satish said:   7 years ago
Here, What is mean by var?

Vasam sai prathyusha said:   6 years ago
I can't understand. Anyone Please explain once.

Nagchandra said:   1 decade ago
void main()
{
float a=1.1;
double b=1.1;

if(a==b)
{
printf(" I love you\n");
}
else
{
printf(" I hate you\n");
}
}

Output: I hate you

void main()
{
float a=1;
double b=1;

if(a==b)
{
printf(" I love you\n");
}
else
{
printf(" I hate you\n");
}
}

Output: I love you

How this will happen if we consider var equalization?

Sampavi said:   1 decade ago
What is real number? the real numbe means 20.05 means 20 is real number then how it double.

Ram said:   1 decade ago
If a number is declare as float f=20. 03; then is it treated as double or not?

Sahantha said:   1 decade ago
1,2,3,4,5,6,1/2, 3/4 these are all real. The square root of negative is an unreal number.

Cheluvarajesh said:   1 decade ago
I have 2 questions

1. What you mean by double precision ?
2. Consider the following code

void main()
{
float a=1.1;
double b=1.1;

if(a==b)
{
printf(" I love you\n");
}
else
{
printf(" I hate you\n");
}
}

If you execute this code you will get output as I hate you..
How this is happening ?


Post your comments here:

Your comments will be displayed after verification.