C and infinity arithmetic
#include <math.h> void main() { double a = 0; a += 5e308; a -= 3.5e308; if (a == INFINITY) { printf(“1 %en”, a); } else printf(“0 %en”, a); } Here, the first print line is what I expect but why is the second print statement executed? I think a should be positive infinity as infinity […]
C and infinty arithmetic
#include<math.h> void main(){double a=0; a += 5e308; a -= 3.5e308; if(a == INFINITY){ printf(“1 %e”,a);} else printf(“0 %e”,a); } here the first print line is what i expect by why the second print statement is executed because a should be posivite infinity as infinty -3.5e308 should be positive infinity right in line 4? i have […]