rem: var sum_x = 0; var sum_y = 0; var sum_x_squared = 0; var sum_y_squared = 0; var sum_xy = 0; var n  = array.length; for (var i = 0; i != n; ++i) { var x = i; var y = array[i]; sum_x += x; sum_y += y; sum_x_squared += x*x; sum_y_squared += y*y; sum_xy += x*y; } var x_average = sum_x / n; var y_average = sum_y / n; var sxx = sum_x_squared - n * x_average * x_average; var syy = sum_y_squared - n * y_average * y_average; var sxy = sum_xy - n * x_average * y_average; var r = sxy*sxy/(sxx*syy); return r; 
add: var sum_x = 0; var sum_y = 0; var sum_x_squared = 0; var sum_y_squared = 0; var sum_xy = 0; var n  = array.length; for (var i = 0; i != n; ++i) { var x = i; var y = array[i]; sum_x += x; sum_y += y; sum_x_squared += x*x; sum_y_squared += y*y; sum_xy += x*y; } var x_average = sum_x / n; var y_average = sum_y / n; var sxx = sum_x_squared - n * x_average * x_average; var syy = sum_y_squared - n * y_average * y_average; var sxy = sum_xy - n * x_average * y_average; var r = sxy*sxy/(sxx*syy); return r; 
context: function calculate_least_square_r(array){	var sum_x = 0;	var sum_y = 0;	var sum_x_squared = 0;	var sum_y_squared = 0;	var sum_xy = 0;	var n  = array.length;	for (var i = 0; i != n; ++i) {		var x = i;		var y = array[i];		sum_x += x;		sum_y += y;		sum_x_squared += x*x;		sum_y_squared += y*y;		sum_xy += x*y;	}	var x_average = sum_x / n;	var y_average = sum_y / n;	var sxx = sum_x_squared - n * x_average * x_average;	var syy = sum_y_squared - n * y_average * y_average;	var sxy = sum_xy - n * x_average * y_average;	var r = sxy*sxy/(sxx*syy);	return r; }
meta: 10520	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/10520/0b675418ba636127763e94e614e62364d6caa659/regress-313967-01.js/buggy/js/tests/js1_5/Regress/regress-313967-01.js