[ create a new paste ] login | about

Link: http://codepad.org/vgCsH0Pd    [ raw code | output | fork ]

BruceZhou - C++, pasted on Dec 9:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
int main()
{       
        int n=1;
        float in=0.0;
        for(int i=0;i<10;i++)
	{
        n*=10000;
	in = (float)1.0/n;
	cout<<in<<endl; /*"in" will become "inf" because out of range*/
        }
        bool temp=(in==0.0);
        cout<<temp<<endl;
        return 0;
}


Output:
1
2
3
4
5
6
7
8
9
10
11
1e-04
1e-08
-1.3748e-09
5.33356e-10
6.01687e-10
-6.27417e-10
3.72529e-09
inf
inf
inf
false


Create a new paste based on this one


Comments: