How to use the bignumber.js function in bignumber

To help you get started, we’ve selected a few bignumber examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cartesi / arbitration-dlib / utils / mm.js View on Github external
merkel() {
    // console.log(this.memoryMap);
    return this.subMerkel(this.memoryMap, BigNumber(0), 61);
  }
}
github interledgerjs / ilp / src / lib / psk2.js View on Github external
function highLowToBigNumber (highLow) {
  // TODO use a more efficient method to convert this
  const long = Long.fromBits(highLow[1], highLow[0], true)
  return new BigNumber(long.toString(10))
}
github KyberNetwork / smart-contracts / test / liquidityConversionRate.js View on Github external
it("should test getrate for buy=false and qtyInSrcWei = non_0.", async function () {
        let qtyInSrcWei = BigNumber(deltaT).mul(tokenPrecision)
        let expectedResult = priceForDeltaT(feePercent, r, pMin, deltaT, e0).mul(precision).valueOf()
        let result =  await liqConvRatesInst.getRateWithE(token.address,false,qtyInSrcWei,eInFp);
        Helper.assertAbsDiff(result, expectedResult, expectedDiffInPct)
    });
github KyberNetwork / smart-contracts / test / liquidityConversionRate.js View on Github external
it("should test getrate for buy=true and qtyInSrcWei = non_0.", async function () {
        let expectedResult = priceForDeltaE(feePercent, r, pMin, deltaE, e0).mul(precision).valueOf()
        let qtyInSrcWei = BigNumber(deltaE).mul(precision)
        let result =  await liqConvRatesInst.getRateWithE(token.address,true,qtyInSrcWei,eInFp);
        Helper.assertAbsDiff(result, expectedResult, expectedDiffInPct)
    });
github centrehq / centre-tokens / test / TokenTestUtils.js View on Github external
function newBigNumber(value) {
    var hex = new BigNumber(value).toString(16);
    return new BN(hex, 16);
}
github AugurProject / augur.js / test / unit / trading / simulation / simulate-sell.js View on Github external
assertions: function (output) {
      assert.deepEqual(output, {
        sharesFilled: new BigNumber("2", 10),
        settlementFees: ZERO,
        worstCaseFees: ZERO,
        otherSharesDepleted: ZERO,
        sharesDepleted: ZERO,
        tokensDepleted: new BigNumber("0.9", 10),
        shareBalances: [ZERO, new BigNumber("5", 10)],
      });
    },
  });
github AugurProject / augur.js / test / unit / trading / simulation / simulate-fill-bid-order.js View on Github external
assertions: function (output) {
      assert.deepEqual(output, {
        sharesFilled: new BigNumber("2", 10),
        sharesToCover: new BigNumber("1", 10),
        settlementFees: new BigNumber("0.014", 10),
        worstCaseFees: new BigNumber("0.014", 10),
        sharesDepleted: new BigNumber("2", 10),
        tokensDepleted: new BigNumber("0", 10),
        shareBalances: [new BigNumber("3", 10), new BigNumber("0", 10)],
      });
    },
  });
github AugurProject / augur.js / test / unit / trading / simulation / simulate-buy.js View on Github external
assertions: function (output) {
      assert.deepEqual(output, {
        sharesFilled: new BigNumber("2", 10),
        settlementFees: new BigNumber("0.006", 10),
        worstCaseFees: new BigNumber("0.009", 10),
        otherSharesDepleted: new BigNumber("3", 10),
        sharesDepleted: ZERO,
        tokensDepleted: ZERO,
        shareBalances: [ZERO, new BigNumber("2", 10)],
      });
    },
  });
github AugurProject / augur.js / test / unit / trading / simulation / simulate-fill-ask-order.js View on Github external
assertions: function (output) {
      assert.deepEqual(output, {
        sharesFilled: new BigNumber("2", 10),
        sharesToCover: new BigNumber("1", 10),
        settlementFees: new BigNumber("0.006", 10),
        worstCaseFees: new BigNumber("0.006", 10),
        otherSharesDepleted: new BigNumber("2", 10),
        tokensDepleted: ZERO,
        shareBalances: [ZERO, new BigNumber("3", 10)],
      });
    },
  });
github brave-intl / brave-payments-tools / scripts / uphold / transferBalance.js View on Github external
transact(source, keypair, body, false, (result) => {
      console.log('before: ' + body.denomination.amount)
      body.denomination.amount = new BigNumber(body.denomination.amount)
      if (body.denomination.amount.isZero()) return console.log('zero balance')
      body.denomination.amount = body.denomination.amount.minus(new BigNumber(result.origin.fee))
      if (body.denomination.amount.lessThanOrEqualTo(0)) return console.log('insufficient balance: ' + card.available)
      body.denomination.amount = body.denomination.amount.toString()
      console.log(' after: ' + body.denomination.amount)
      transact(source, keypair, body, true, (result) => {})
    })
  })

bignumber

A pure javascript implementation of BigIntegers and RSA crypto.

Unknown
Latest version published 13 years ago

Package Health Score

39 / 100
Full package analysis

Popular bignumber functions