Fixed typo in usage example

This commit is contained in:
Juan Hernández Serrano 2019-04-06 12:41:11 +02:00
parent 99bb8ac68b
commit 63cd4eb4e8
2 changed files with 24 additions and 18 deletions

View File

@ -28,17 +28,20 @@ For web brosers, you can also [download the bundle from GitHub](https://raw.gith
## Usage examples ## Usage examples
```javascript ```javascript
const modArith = require('bigint-mod-arith'); const bigintModArith = require('bigint-mod-arith');
let a = BigInt(5); // more linter friendly // Stage 3 BigInts with value 666 can be declared as BigInt('666')
let b = 2n; // stage 3 short syntax for BigInt // or the shorte no-linter-friendly new syntax 666n
let n = 19n;
console.log(modArith.modPow(a, b, n)); // prints 13 let a = BigInt('5');
let b = BigInt('2');
console.log(modArith.modInv(2n, 5n)); // prints 3 let n = BigInt('19');
console.log(modArith.modInv(3n, 5n)); // prints 2 console.log(bigintModArith.modPow(a, b, n)); // prints 6
console.log(bigintModArith.modInv(BigInt('2'), BigInt('5'))); // prints 3
console.log(bigintModArith.modInv(BigInt('3'), BigInt('5'))); // prints 2
``` ```
# bigint-mod-arith JS Doc # bigint-mod-arith JS Doc

View File

@ -28,17 +28,20 @@ For web brosers, you can also [download the bundle from GitHub](https://raw.gith
## Usage examples ## Usage examples
```javascript ```javascript
const modArith = require('bigint-mod-arith'); const bigintModArith = require('bigint-mod-arith');
let a = BigInt(5); // more linter friendly // Stage 3 BigInts with value 666 can be declared as BigInt('666')
let b = 2n; // stage 3 short syntax for BigInt // or the shorte no-linter-friendly new syntax 666n
let n = 19n;
console.log(modArith.modPow(a, b, n)); // prints 13 let a = BigInt('5');
let b = BigInt('2');
console.log(modArith.modInv(2n, 5n)); // prints 3 let n = BigInt('19');
console.log(modArith.modInv(3n, 5n)); // prints 2 console.log(bigintModArith.modPow(a, b, n)); // prints 6
console.log(bigintModArith.modInv(BigInt('2'), BigInt('5'))); // prints 3
console.log(bigintModArith.modInv(BigInt('3'), BigInt('5'))); // prints 2
``` ```
# bigint-mod-arith JS Doc # bigint-mod-arith JS Doc