Fixed typo in usage example
This commit is contained in:
parent
99bb8ac68b
commit
63cd4eb4e8
21
README.hbs
21
README.hbs
|
@ -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
|
||||||
|
|
21
README.md
21
README.md
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue