Graceful underwear

I have been looking for this for so long, but I cannot understand what this question means.

Question:

Write a program in any language to determine how your computer handles graceful 
underflow.

I understand that the overflow condition looks something like this: if an integer can store the maximum value of x , and if we assign the value x + 1 , the value x + 1 will be converted to the smallest value that the integer can hold. I understand that overflow is just the opposite.

How does this relate to high-performance scientific computing / points in linear algebra?

I read this link, but I think that this is the same overflow / overflow stuff that I mentioned above. What does elegant underwear mean?

+4
source share
1 answer

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.

+2
source

All Articles