error -1.#IND00 in vc++2010

hello;
I tried to write a function that calculates the harmonic average as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
 long double Harmonique(long double *t,int l)
{
	long double s=0.0;
	for(int i=0;i<l;i++)
	{
		if(t[i]==0){
			printf("error!!!");
			 s +=1.0/(1+t[i]);}
		else	s +=1.0/t[i];
	}
	return  l/s;
}


the console I have this error -1.#IND00 .
what is the origin of this error ?
cordialy
"-1.#IND" is how Windows displays a NaN (not-a-number, e.g. what you get when dividing zero by zero or taking a square root of a negative). Do you an example that could be compiled so it would be easier to see where the NaN came from?
Here, I found the solution. the * t I used in "main" was of type int, so there was a problem of division by zero.
thank you for help.
Topic archived. No new replies allowed.