C Programming - Floating Point Issues - Discussion

Discussion :: Floating Point Issues - General Questions (Q.No.1)

1. 

What are the different types of real data type in C ?

[A]. float, double
[B]. short int, double, long int
[C]. float, double, long double
[D]. double, long int, float

Answer: Option C

Explanation:

The floating point data types are called real data types. Hence float, double, and long double are real data types.

Safi said: (Dec 30, 2011)  
A real data type is float. Therefor float, double, long double re real data types.

Raveena Yadav said: (Feb 3, 2012)  
Is long int not real data type ?

Sri said: (Apr 24, 2012)  
long int is not real datatype. int gives a round vaule

Shiv Gauri said: (Jul 30, 2012)  
The floating point data types are called real data types. Hence float, double, and long double are real data types.

Reddy said: (Aug 29, 2012)  
What is the need of giving (unsigned char) p[i] ?

Ranga said: (Sep 23, 2012)  
Why it is called real data type?

Smiline Jeba said: (Jan 30, 2013)  
Because it gives the real value. Ex 2/5=2.50 it is the real value. It calculate the value accurately. If am wrong. Please correct me.

Ajay said: (May 8, 2013)  
float, double and long double called real data type because it's compute real value of any number. For Example if we want to get accurate output suppose A = 2.3 and B = 3.2 and C, Thus, C = A +B;

We get 5.500000; Hence its called a real data type.

Ajay said: (May 8, 2013)  
Could you explain me what is deference between double and long double real data type?

Thomsika said: (May 15, 2013)  
Can you explain the difference between float, double and long double?

Sivakumar said: (Jun 28, 2013)  
int main(){
float x;
x=(float)3.3==3.3;
printf("%f",x);
return 0;
}

Ans 0.00


int main(){
float x;
x=(float)3.5==3.5;
printf("%f",x);
return 0;
}

Ans 1.00

How it is possible please anyone could you explain please?

Akshay said: (Aug 31, 2013)  
#include<stdio.h>
int main(){
float x;
x=(float)4.2==(float)4.2;
printf("%f",x);

x=(float)3.5==3.5;
printf("\n%f",x);
return 0;
}

Answer:

1.00
1.00

This one works. I just converted both no into float.

I just cannot figure out exactly why this is happening. Hope someone can figure out.

V.Koks said: (Aug 5, 2014)  
How the output came like this?

Sachin said: (May 8, 2015)  
Anyone could explain me how this code has worked?

Anusha said: (Jun 18, 2015)  
I do not exactly. But I think this concept follows partial initialization, full initialization, null initialization. If I'm wrong any explain me the concept.

Mustaqueem Khan said: (Jun 26, 2015)  
Very good example given by all of you. Thanks for your time.

Akshay said: (Jul 13, 2017)  
@Akshay.

Just use like Logical Operators (float)4.2==(float)4.2 is equal, so that's true and prints 1, as float, 1.0000000.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.