|
1 |
| ---[[ |
2 |
| -The MIT License (MIT) |
3 |
| -
|
4 |
| -Copyright (c) 2020 Eduardo Bart (https://github.com/edubart) |
5 |
| -
|
6 |
| -Permission is hereby granted, free of charge, to any person obtaining a copy |
7 |
| -of this software and associated documentation files (the "Software"), to deal |
8 |
| -in the Software without restriction, including without limitation the rights |
9 |
| -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10 |
| -copies of the Software, and to permit persons to whom the Software is |
11 |
| -furnished to do so, subject to the following conditions: |
12 |
| -
|
13 |
| -The above copyright notice and this permission notice shall be included in all |
14 |
| -copies or substantial portions of the Software. |
15 |
| -
|
16 |
| -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 |
| -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 |
| -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 |
| -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20 |
| -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21 |
| -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
22 |
| -SOFTWARE. |
23 |
| -]] |
24 |
| - |
25 | 1 | --[[--
|
| 2 | +lua-bint - v0.4.0 - 20/Jan/2022 |
| 3 | +Eduardo Bart - edub4rt@gmail.com |
| 4 | +https://github.com/edubart/lua-bint |
| 5 | +
|
26 | 6 | Small portable arbitrary-precision integer arithmetic library in pure Lua for
|
27 | 7 | computing with large integers.
|
28 | 8 |
|
@@ -149,7 +129,7 @@ assert(bits % wordbits == 0, 'bitsize is not multiple of word bitsize')
|
149 | 129 | assert(2*wordbits <= intbits, 'word bitsize must be half of the lua integer bitsize')
|
150 | 130 | assert(bits >= 64, 'bitsize must be >= 64')
|
151 | 131 |
|
152 |
| --- Create bint class |
| 132 | +-- Create bint module |
153 | 133 | local bint = {}
|
154 | 134 | bint.__index = bint
|
155 | 135 |
|
@@ -1193,13 +1173,13 @@ function bint.umod(x, y)
|
1193 | 1173 | end
|
1194 | 1174 |
|
1195 | 1175 | --- Perform integer truncate division and modulo operation between two numbers considering bints.
|
1196 |
| --- This is effectively the same of @{bint.__tdiv} and @{bint.__tmod}. |
| 1176 | +-- This is effectively the same of @{bint.tdiv} and @{bint.tmod}. |
1197 | 1177 | -- @param x The numerator, a bint or lua number.
|
1198 | 1178 | -- @param y The denominator, a bint or lua number.
|
1199 | 1179 | -- @return The quotient following the remainder, both bint or lua number.
|
1200 | 1180 | -- @raise Asserts on attempt to divide by zero or on division overflow.
|
1201 |
| --- @see bint.__tdiv |
1202 |
| --- @see bint.__tmod |
| 1181 | +-- @see bint.tdiv |
| 1182 | +-- @see bint.tmod |
1203 | 1183 | function bint.tdivmod(x, y)
|
1204 | 1184 | local ax, ay = bint.abs(x), bint.abs(y)
|
1205 | 1185 | local ix, iy = bint.tobint(ax), bint.tobint(ay)
|
|
0 commit comments