mirror of
https://github.com/ziglang/zig.git
synced 2024-12-14 07:10:16 +00:00
Add arbitrary-precision integer to std
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 986a2b3243/bench
for rough performance comparison numbers.
Closes #364.
This commit is contained in:
parent
0a95b0f1ff
commit
dc8bda7e02
@ -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"
|
||||
|
5
std/math/big/index.zig
Normal file
5
std/math/big/index.zig
Normal file
@ -0,0 +1,5 @@
|
||||
pub use @import("int.zig");
|
||||
|
||||
test "math.big" {
|
||||
_ = @import("int.zig");
|
||||
}
|
2023
std/math/big/int.zig
Normal file
2023
std/math/big/int.zig
Normal file
File diff suppressed because it is too large
Load Diff
@ -132,6 +132,8 @@ pub const tan = @import("tan.zig").tan;
|
||||
pub const complex = @import("complex/index.zig");
|
||||
pub const Complex = complex.Complex;
|
||||
|
||||
pub const big = @import("big/index.zig");
|
||||
|
||||
test "math" {
|
||||
_ = @import("nan.zig");
|
||||
_ = @import("isnan.zig");
|
||||
@ -177,6 +179,8 @@ test "math" {
|
||||
_ = @import("tan.zig");
|
||||
|
||||
_ = @import("complex/index.zig");
|
||||
|
||||
_ = @import("big/index.zig");
|
||||
}
|
||||
|
||||
pub fn min(x: var, y: var) @typeOf(x + y) {
|
||||
|
Loading…
Reference in New Issue
Block a user