 
   for( int i = 0; i < size * size; i++ )
   {
-    temp += ( h_c[i] - h_c1[i] ) * ( h_c[i] - h_c1[i] );
+     temp = max( temp, abs( (double)h_c[i] - (double)h_c1[i] )/
+                      abs((double)h_c[i]) );
   } /* end for */
-
-  printf("error is %f\n",temp);
-  if( temp > 10 ) printf("FAIL\n");
+  printf("Maximum error is %e percent \n",temp*100.0);
+  if( temp > 0.001 ) printf("FAIL\n");
   else printf("PASS\n");
 
 /* cleanup */


/* call CUBLAS dgemm */

  checkCUBLAS( 
  cublasDgemm( handle, CUBLAS_OP_N, CUBLAS_OP_N,
               size, size, size,
               &alpha, 
               d_a, size,
               d_b, size,
               &beta,
               d_c, size )
              );

/* stop timers */



  fprintf(stdout, "Matrix size is %d\n",size);

  floatType_t *h_a, *h_b, *h_c, *h_c1;
  floatType_t *d_a, *d_b, *d_c;
 
  size_t numbytes = (size_t ) size * (size_t ) size * sizeof( floatType_t );

  h_a = (floatType_t *) malloc( numbytes );
  if( h_a == NULL )
  {
    fprintf(stderr,"Error in host malloc\n");
    return 911;
  }

  h_b = (floatType_t *) malloc( numbytes );
  if( h_b == NULL )
  {
    fprintf(stderr,"Error in host malloc\n");
    return 911;
  }

  h_c = (floatType_t *) malloc( numbytes );
  if( h_c == NULL )
  {
    fprintf(stderr,"Error in host malloc\n");
    return 911;
  }

  h_c1 = (floatType_t *) malloc( numbytes );
  if( h_c1 == NULL )
  {
    fprintf(stderr,"Error in host malloc\n");
