// This is the boundary in theory.
assertEq(parseInt(1e21), 1);
// This is the boundary in practice.
assertEq(parseInt(1e21 - 65537) > 1e20, true);
assertEq(parseInt(1e21 - 65536), 1);
assertEq(parseInt(1e21 + 65536), 1);
// Check that we understand floating point accuracy near the boundary
assertEq(1e21 - 65537 !== 1e21 - 65536, true);
assertEq(1e21 - 65536, 1e21);
assertEq(1e21 + 65535, 1e21);
assertEq(1e21 + 65536, 1e21);
// ES5 leaves exact precision in ToString(bigMagNum) undefined, which // might make this value inconsistent across implementations (maybe, // nobody's done the math here). Regardless, it's definitely a number // very close to 1, and not a large-magnitude positive number.
assertEq(1e21 + 65537 !== 1e21, true);
assertEq(parseInt(1e21 + 65537) < 1.001, true);
// This is the boundary in theory.
assertEq(parseInt(-1e21), -1);
// This is the boundary in practice.
assertEq(parseInt(-1e21 + 65537) < -1e20, true);
assertEq(parseInt(-1e21 + 65536), -1);
assertEq(parseInt(-1e21 - 65536), -1);
// Check that we understand floating point accuracy near the boundary
assertEq(-1e21 + 65537 !== -1e21 + 65536, true);
assertEq(-1e21 + 65536, -1e21);
assertEq(-1e21 - 65535, -1e21);
assertEq(-1e21 - 65536, -1e21);
// ES5 leaves exact precision in ToString(bigMagNum) undefined, which // might make this value inconsistent across implementations (maybe, // nobody's done the math here). Regardless, it's definitely a number // very close to -1, and not a large-magnitude negative number.
assertEq(-1e21 - 65537 !== 1e21, true);
assertEq(parseInt(-1e21 - 65537) > -1.001, true);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.