C Programming - Floating Point Issues - Discussion
Discussion Forum : Floating Point Issues - General Questions (Q.No. 3)
3.
If the binary eauivalent of 5.375 in normalised form is 0100 0000 1010 1100 0000 0000 0000 0000, what will be the output of the program (on intel machine)?
#include<stdio.h>
#include<math.h>
int main()
{
float a=5.375;
char *p;
int i;
p = (char*)&a;
for(i=0; i<=3; i++)
printf("%02x\n", (unsigned char)p[i]);
return 0;
}
Discussion:
117 comments Page 11 of 12.
Megha tavrech said:
1 decade ago
I didn't understand this.
How it get executed.
P= (char *) &a;.
How it get executed.
P= (char *) &a;.
Vignesh said:
1 decade ago
Hi, can anyone tell me in what way the given program helps us to find the answer for the given question.
Sathish said:
2 decades ago
Hi, i have a doubt
in the statement
p=(char *)&a;
why we are used (char *) here
in the statement
p=(char *)&a;
why we are used (char *) here
Reka said:
2 decades ago
How to normalise a number?
Nikhil kadam said:
2 decades ago
Why we tha answer is not 00 00 CA 04?
Nikhil said:
2 decades ago
Thanks preethi.
Vishnu kant said:
2 decades ago
Thanks preethi. Thanks pradeep. :-).
Aishwarya said:
2 decades ago
I agree with preeti answer.
Subrata said:
2 decades ago
Thank you preeti.
Ankit Chandra said:
2 decades ago
Thank you preeti. I really needed that ansswer badly.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers