Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bigint #305

Merged
merged 19 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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