How to : numerical integration by quadrature in C language / remove NaN

What I wanna solve it the problem following ( by quadrature method ) I want to get two arrays of data ( z & tau ) from z, tau to z, tau.

Since the integrand diverges at z=0.9, 1.125, I need to tame the divergence, but firstly, I want to make simple scheme of my program.

Following is my C language code of numerical integration

#include <stdio.h>
#include <math.h>

int main(int argc, char **argv){
int Narray;
int k;
Narray = 2250;
double zeta[Narray];
double dzeta = 0.225/Narray;
double tau[Narray];
zeta=0.9;
tau=0;

for (k=1; k<Narray-1 ; k++){
zeta[k]=zeta[k-1]+dzeta;
tau[k]=tau[k-1]+dzeta*zeta[k]/sqrt(0.987654*(zeta[k]-0.9)*(9/8-zeta[k]));
printf("zeta = %lf tau = %lf \n", zeta[k], tau[k]);
}
return 0;
}

However, when I compile the code in ubuntu, NaN appears as result...

Also, datas were different from the calculation by Wolframalpha.

( I've sampled few points and compared with Wolfram alpha. ) I suppose problem occurs at the equation of zeta... How can I fix this problem?

• Haven't checked the rest but 9/8 is an integer expression and so returns an integer which will be 1. Try 9.0/8.0, and also understand why this is important. May 20 '19 at 19:03
• Thank you! I forgot the basic concept that what I usually say 9/8 is not the same to computer... May 20 '19 at 23:47
• NaN disappeared and What's left is just taming improper integration over 0.9 to 0.9+dzeta. And I will try this one myself . Thank you again! May 20 '19 at 23:50
• @IanBush if you write your comment as answer user501175 can accept it. May 22 '19 at 10:51