- if(doubles==0){chaovar=0;}
- else{
- double g=singles/doubles;
- chaovar = doubles*(0.25*pow(g,4)+pow(g,3)+0.5*pow(g,2));
+ if(singles > 0 && doubles > 0){
+ chaovar = singles*(singles-1)/(2*(doubles+1))
+ + singles*pow(2*singles-1, 2)/(4*pow(doubles+1,2))
+ + pow(singles, 2)*doubles*pow(singles-1, 2)/(4*pow(doubles+1,4));