   }
   __syncthreads();
   if(index == 0) {
-    float vol  = returns[n-1]/(n-1);
+    float vol  = returns[n-1]/(n-2);
     float sd = sqrt(vol); 
     printf("SD  %f Volatility   %f\n",sd,vol); 
   }

  int index = blockIdx.x * blockDim.x + threadIdx.x;
  __shared__ double returns[256]; 
  //Calculate Log Returns
  double logRt = 0.0; 
  if(index < n) {
    // logRt = log(__int_as_float(price[index+1])) - log(__int_as_float(price[index]));    
    logRt = price[index]; 
    returns[index] = logRt; 
  }
  __syncthreads();

    __syncthreads(); 
  }
  __syncthreads();

  float ravg = returns[n-1]/n; 
  float rdiffSq = (logRt - ravg) * (logRt - ravg); 
