Well, according to the link posted by @StoneBird in this link , it was especially useful. Here I created a program in c that demonstrates the same thing.
#include <stdio.h>
#include <math.h>
int main(int argc, char **argv)
{
unsigned int s,e,m;
unsigned int* ptr;
float a,temp=0;
a=1;
float min=pow(2,-129);
while(a>min){
temp=a;
a=a/2;
}
printf("Value=%e\n",temp);
ptr=(unsigned int*)&temp;
s = *ptr >> 31;
e = *ptr & 0x7f800000;
e >>= 23;
m = *ptr & 0x07fffff;
printf("sign = %x\n",s);
printf("exponent = %x\n",e);
printf("mantissa = %x\n",m);
return 0;
}
Here the min variable is used to change the final number ... I use min = pow (2, -129), pow (2, -128) and pow (2, -130) to see the results and see how the Denormal number appears . This wiki page explains all this.
source
share