abs - nodef/extra-bigint GitHub Wiki

Get the absolute of a bigint.

Similar: abs, sign.

function abs(x)
// x: a bigint
const xbigint = require('extra-bigint');


xbigint.abs(-2n);
// → 2n

xbigint.abs(0n);
// → 0n

xbigint.abs(5n);
// → 5n

References