haikuwebkit/LayoutTests/js/script-tests/dfg-int-overflow-large-cons...

51 lines
1.3 KiB
JavaScript

description(
"Tests that our optimization to elide overflow checks understands that if we keep adding huge numbers, we could end up creating a number that is not precisely representable using doubles."
);
function foo(a) {
var x = a;
x += 281474976710655;
x += 281474976710654;
x += 281474976710653;
x += 281474976710652;
x += 281474976710655;
x += 281474976710654;
x += 281474976710653;
x += 281474976710652;
x += 281474976710655;
x += 281474976710654;
x += 281474976710653;
x += 281474976710652;
x += 281474976710655;
x += 281474976710654;
x += 281474976710653;
x += 281474976710652;
x += 281474976710655;
x += 281474976710654;
x += 281474976710653;
x += 281474976710652;
x += 281474976710655;
x += 281474976710654;
x += 281474976710653;
x += 281474976710652;
x += 281474976710655;
x += 281474976710654;
x += 281474976710653;
x += 281474976710652;
x += 281474976710655;
x += 281474976710654;
x += 281474976710653;
x += 281474976710652;
x += 281474976710655;
x += 281474976710654;
x += 281474976710653;
x += 281474976710652;
x += 281474976710655;
x += 281474976710654;
x += 281474976710653;
x += 281474976710652;
return x | 0
}
dfgShouldBe(foo, "foo(2147483647)", "2147483552");