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 9 of 12.
Nikhil kadam said:
1 decade ago
Why we tha answer is not 00 00 CA 04?
Vishnu kant said:
1 decade ago
Thanks preethi. Thanks pradeep. :-).
Tayyaba said:
1 decade ago
@Dheeraj. %02X means 1st two bytes.
Suresh Gupta said:
1 decade ago
We are use database in C or not ?
Shashikant said:
1 decade ago
Thank you to solve this problem.
Sairam said:
1 decade ago
Thanks preethi, visual, gaurav.
Malathi said:
1 decade ago
Thank you preethi and pradeep.
Deepak naik said:
1 decade ago
What is normalised form in C?
Mini said:
1 decade ago
I think preethi is correct.
Aishwarya said:
1 decade ago
I agree with preeti answer.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers