Skip to content

Commit f717ade

Browse files
committed
Put <hr> around bigint methods for consistency
1 parent c4c300e commit f717ade

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/Runtime Environment/Bigint.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,60 +10,71 @@ local bigint = require "pluto:bigint"
1010
print(new bigint("123")) --> 123
1111
```
1212

13+
---
1314
### `bigint.tostring`, `__tostring`
1415
As seen above, the `__tostring` metamethod provides a string representation of the Bigint in decimal.
1516

17+
---
1618
### `bigint.hex`
1719
Provides a hexadecimal representation of the Bigint.
1820
```pluto
1921
local bigint = require "pluto:bigint"
2022
print(new bigint("420"):hex()) --> 1A4
2123
```
2224

25+
---
2326
### `bigint.binary`
2427
Provides a binary representation of the Bigint.
2528
```pluto
2629
local bigint = require "pluto:bigint"
2730
print(new bigint("420"):binary()) --> 110100100
2831
```
2932

33+
---
3034
### `bigint.add`, `__add`
3135
Adds two bigints together. Returns a new bigint.
3236

37+
---
3338
### `bigint.sub`, `__sub`
3439
Performs subtraction on two bigints. Returns a new bigint.
3540

41+
---
3642
### `bigint.mul`, `__mul`
3743
Performs multiplication on two bigints. Returns a new bigint.
3844

45+
---
3946
### `bigint.div`
4047
Performs division on two bigints. Returns two new bigints: quotient and remainder.
4148
```pluto
4249
local bigint = require "pluto:bigint"
4350
print(new bigint(10):div(new bigint(3))) --> 3 1
4451
```
4552

53+
---
4654
### `__div`
4755
Performs division on two bigints. Returns a new bigint with the quotient.
4856
```pluto
4957
local bigint = require "pluto:bigint"
5058
print(new bigint(10) / new bigint(3)) --> 3
5159
```
5260

61+
---
5362
### `bigint.mod`, `__mod`
5463
Performs divison on two bigints. Returns a new bigint with the remainder.
5564
```pluto
5665
local bigint = require "pluto:bigint"
5766
print(new bigint(10) % new bigint(3)) --> 1
5867
```
5968

69+
---
6070
### `bigint.pow`, `__pow`
6171
Performs expontentiation on two bigints. Returns a new bigint.
6272
```pluto
6373
local bigint = require "pluto:bigint"
6474
print(new bigint(2) ^ new bigint(10)) --> 1024
6575
```
6676

77+
---
6778
### `bigint.bitlength`
6879
Returns the position of the most significant set bit as a plain integer.
6980
```pluto

0 commit comments

Comments
 (0)