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;
}
40 AC 00 00
04 CA 00 00
00 00 AC 40
00 00 CA 04
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
117 comments Page 6 of 12.

Megha Verma said:   9 years ago
Thank you so much @Shilpa M.Raj. Your explanation is really good and clear.

Yamuna said:   1 decade ago
I have one doubt here we used unsigned char why don't we use signed char ?

Himanshu said:   1 decade ago
Hi.

Rithvika normalization is one way to reduce the redundancy in table.

Rajasekaran said:   1 decade ago
Thank preeti and pradeep.

How do normaliize ? please say anyone for me.

Abhi17188@gmail.com said:   1 decade ago
If little endian prints from bottom to top, then why D is not correct.

Megha tavrech said:   1 decade ago
I didn't understand this.

How it get executed.

P= (char *) &a;.

IRSHAD ALAM said:   1 decade ago
@ Preethi: Thnx for providing nice answer...

clear to understand.

Chaitanya@rgukt said:   1 decade ago
Can any please explain How to do normalization of floating point?

Tamil kudimagan said:   6 years ago
@Nikitha explanation is good to compare @Prithi thank you, mam.
(1)

Pramod Kumar said:   1 decade ago
p = (char*)&a;

Can anyone explain meaning of this line?


Post your comments here:

Your comments will be displayed after verification.