I made some simple mistake (conversion?) in my program.. I will be gratefull if anyone has an idea what's wrong with it;) The problem is not with the algorithm itself so I am not explaining it - the problem is: why the condition placed in the code between // HERE and // HERE seems to be never true? (The function does not work correctly) Try this piece of code with 0.7 and 4 on entry.

int s(int k) // factorial for integers
  if (k==0 || k==1) {return 1;}
  else {return (s(k-1))*k;}   

double newtonsymbol(double r, int k) 

       if (k<0) return 0; 
       int s(int k); //that's factorial above
       static double t=r;
       double h;
       static double numerator=r; 
       double denominator;  
       std::cout<<h-t<<" "<<t<<std::endl;
 /* that's optional; it shows the mistake; the condition would be fulfilled if h-t==0 */
      if (t==h)
      {denominator=s(k); std::cout<<"ok"<<std::endl; 
      return (numerator/denominator);}
      if (h<-10) {return 3;}
// that is added to stop the function so you can see what's going on
     {std::cout<<"not ok"<<std::endl; 

int main ()
    double p=0.7; int l=4; 
    return 0;

Why would they be equal? You would only expect them to be equal if k is 1.0.

Thanks for quick help! These are my first steps in programming ;)