Skip to content

Commit

Permalink
Merge pull request #305 from jialunzhang-psu/bigint
Browse files Browse the repository at this point in the history
Bigint
  • Loading branch information
bobzhang authored May 2, 2024
2 parents d01ba8f + ebc85ed commit c6daac1
Show file tree
Hide file tree
Showing 6 changed files with 1,145 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bigint/README.md
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.
Loading

0 comments on commit c6daac1

Please sign in to comment.