Skip to content

Commit

Permalink
Add arbitrary-precision integer to std
Browse files Browse the repository at this point in the history
A few notes on the implementation:

 - Any unsigned power of two integer type less than 64 bits in size is supported
 as a Limb type.
 - The algorithms used are kept simple for the moment. More complicated
 algorithms are generally only more useful as integer sizes increase a
 lot and I don't expect our current usage to be used for this purpose
 just yet.
 - All branches (practically) have been covered by tests.

See https://github.com/tiehuis/zig-bn/tree/986a2b3243d0454b8430a6adf4ad48611850c1b8/bench
for rough performance comparison numbers.

Closes #364.
  • Loading branch information
tiehuis committed Jun 10, 2018
1 parent 0a95b0f commit dc8bda7
Show file tree
Hide file tree
Showing 4 changed files with 2,033 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -464,6 +464,7 @@ set(ZIG_STD_FILES
"math/atan.zig"
"math/atan2.zig"
"math/atanh.zig"
"math/big/int.zig"
"math/cbrt.zig"
"math/ceil.zig"
"math/complex/abs.zig"
Expand Down
5 changes: 5 additions & 0 deletions std/math/big/index.zig
@@ -0,0 +1,5 @@
pub use @import("int.zig");

test "math.big" {
_ = @import("int.zig");
}

0 comments on commit dc8bda7

Please sign in to comment.