From 3cbc29caf1f6e4d73e1f4229fb1c2057bd4d3d9b Mon Sep 17 00:00:00 2001 From: Jordi Baylina Date: Thu, 5 Sep 2019 17:11:31 +0200 Subject: [PATCH] pow and abs in the bigInt wrapper --- src/bigint.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/bigint.js b/src/bigint.js index 392c69d..b2c594c 100644 --- a/src/bigint.js +++ b/src/bigint.js @@ -177,6 +177,14 @@ if (typeof(BigInt) != "undefined") { return this % c; }; + wBigInt.prototype.pow = function(c) { + return this ** c; + }; + + wBigInt.prototype.abs = function() { + return (this > wBigInt.zero) ? this : -this; + }; + wBigInt.prototype.modPow = function(e, m) { let acc = wBigInt.one; let exp = this;