Skip to content

Instantly share code, notes, and snippets.

@CodeDrome
Created August 29, 2021 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeDrome/58fa79d482e71b32978f384fe7556a7c to your computer and use it in GitHub Desktop.
Save CodeDrome/58fa79d482e71b32978f384fe7556a7c to your computer and use it in GitHub Desktop.
mathjsbignumber.js - part 2
function BigInts()
{
output("BigInt<br>------<br><br>");
const big1 = 9007199254740992n; // 9,007,199,254,740,992
const big2 = 9007199254740993n; // 9,007,199,254,740,993
output(`typeof(big1) = ${typeof(big1)}`);
output(`<br>big1 = ${big1}`);
output(`big2 = ${big2}`);
const r = 3n / 2n;
output(`<br>3n / 2n = ${3n / 2n}`);
try
{
output("<br>Math.min(3n, 5n, 7n, 9n)");
output(Math.min(3n, 5n, 7n, 9n));
}
catch (e)
{
output(e);
}
try
{
output("<br>Math.sign(64n)");
output(Math.sign(64n));
}
catch (e)
{
output(e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment