-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #305 from jialunzhang-psu/bigint
Bigint
- Loading branch information
Showing
6 changed files
with
1,145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Big Integer | ||
|
||
## Description | ||
|
||
An immutable arbitrary precision integer type. Currently it supports the following. | ||
- Basic arithmetic operations, including addition, subtraction, multiplication, division, and modulo. | ||
- Conversion from `Int` and `Int64` to `BigInt`. | ||
- Conversion between `BigInt` and `String` (in decimal format). | ||
- Comparison between `BigInt`. | ||
|
||
## TODO | ||
|
||
- `op_mod` is now implemented by `op_div`. Implement it separately for performance. | ||
- Add +-*/ operators between`BigInt` and `Int`. | ||
- From/To hex string, etc. | ||
- Optimize the implementation of multiplication and division by doing a case analysis on the length of the numbers. For example, currently `op_mul` opts in Karatsuba algorithm when one of the operand's length goes beyond `karatsuba_threshold`. A more elaborated example can be found [here](https://github.com/tbuktu/bigint). | ||
- Other math function, like power, sqrt, log, etc. |
Oops, something went wrong.