I have been searching about this for so long, but i am not able to understand what this question means.
Question:
Write a program in any language to determine how your computer handles graceful
underflow.
I understand that a overflow condition is something like this:
if an integer can store a maximum value of x and if we assign a value of x+1, the value x+1 will be converted to the the lowest value the integer can hold. I understand that underflow is just the reverse.
How does it stand from High performance scientific computing / Linear algebra point of view ?
I have read this link , but i think it's the same underflow/ overflow stuff that i mentioned above. What does the graceful underflow stand for?
Okay,as per the link posted by @StoneBird in this link was particularly helpful. Here i have created a program in c that demonstrates the same.
#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 used min=pow(2,-129), pow(2,-128) and pow(2,-130) to see the results and the saw the Denormal number appear.This wiki page explains it all.