blob: a54e18a5ff38489b0e757df934645dfe752d8258 [file] [log] [blame]
//@ skip if $architecture == "x86"
function sumOfArithSeries(limit) {
return limit * (limit + 1) / 2;
}
var n = 10000000;
function foo() {
var result = 0;
for (var i = 0; i < n; ++i) {
var o = {f: {f:i}};
var p = {f: {f:i + 1}};
result += o.f.f + p.f.f;
}
return result;
}
var result = foo();
if (result != sumOfArithSeries(n - 1) + sumOfArithSeries(n))
throw "Error: bad result: " + result;