compare - nodef/extra-bigint GitHub Wiki

Compare two bigints.

function compare(x, y)
// x: a bigint
// y: another bigint
const xbigint = require('extra-bigint');


xbigint.compare(10n, 12n);
// → -2  (-ve)

xbigint.compare(12n, 12n);
// → 0

xbigint.compare(17n, 12n);
// → 5  (+ve)

References