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 7 of 12.
Rithvika said:
1 decade ago
Hey can any one tell the procedure of normalisation?
Surbhi said:
1 decade ago
What do you mean by big endian and little endian ?
Himanshu said:
1 decade ago
Hi.
Rithvika normalization is one way to reduce the redundancy in table.
Rithvika normalization is one way to reduce the redundancy in table.
Yamuna said:
1 decade ago
I have one doubt here we used unsigned char why don't we use signed char ?
Babu said:
1 decade ago
Hay can anyone please tell me what is memory normalization?
Shashikant said:
1 decade ago
Thank you to solve this problem.
Hardik said:
1 decade ago
Thank you very much preety.
Binit said:
1 decade ago
Binary equivalent of 5 = 101 & 0.375 = 011
so 5.375= 101.011
Normalization means in the left side of decimal should only have one integer example: normalisation of 101.345 = 1.01345* 100
So normalized form is 1.01011*100
So according to IEEE notation 5.375 can be represented as
0100 0000 1010 1100 this can be expressed as 40AC0000
but intel follows little endianess so ans will be
C). 0000AC40
so 5.375= 101.011
Normalization means in the left side of decimal should only have one integer example: normalisation of 101.345 = 1.01345* 100
So normalized form is 1.01011*100
So according to IEEE notation 5.375 can be represented as
0100 0000 1010 1100 this can be expressed as 40AC0000
but intel follows little endianess so ans will be
C). 0000AC40
Kali said:
1 decade ago
@ Binit :
" So normalized form is 1.01011*100
So according to IEEE notation 5.375 can be represented as
0100 0000 1010 1100 this can be expressed as 40AC0000 "
how did you convert the 1.01011 no into normalized form 0100 0000 1010 1100 ???
" So normalized form is 1.01011*100
So according to IEEE notation 5.375 can be represented as
0100 0000 1010 1100 this can be expressed as 40AC0000 "
how did you convert the 1.01011 no into normalized form 0100 0000 1010 1100 ???
Sarava said:
1 decade ago
Thank you preethi.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers