Skip to content

Commit 92b365e

Browse files
committed
Create interfaces for testing against MPFR
Add a way to call MPFR versions of functions in a predictable way, using the `MpOp` trait. Everything new here is guarded by the feature `test-multiprecision` since MPFR cannot easily build on Windows or any cross compiled targets.
1 parent 4b89115 commit 92b365e

File tree

3 files changed

+394
-0
lines changed

3 files changed

+394
-0
lines changed

crates/libm-test/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,21 @@ default = []
1010
# Generate tests which are random inputs and the outputs are calculated with
1111
# musl libc.
1212
test-musl-serialized = ["rand"]
13+
test-multiprecision = ["dep:az", "dep:rug"]
1314

1415
# Build our own musl for testing and benchmarks
1516
build-musl = ["dep:musl-math-sys"]
1617

1718
[dependencies]
1819
anyhow = "1.0.90"
20+
az = { version = "1.2.1", optional = true }
1921
libm = { path = "../.." }
2022
libm-macros = { path = "../libm-macros" }
2123
musl-math-sys = { path = "../musl-math-sys", optional = true }
2224
paste = "1.0.15"
2325
rand = "0.8.5"
2426
rand_chacha = "0.3.1"
27+
rug = { version = "1.26.1", optional = true, default-features = false, features = ["float", "std"] }
2528

2629
[target.'cfg(target_family = "wasm")'.dependencies]
2730
# Enable randomness on WASM

crates/libm-test/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
pub mod gen;
2+
#[cfg(feature = "test-multiprecision")]
3+
pub mod mpfloat;
24
mod num_traits;
35
mod special_case;
46
mod test_traits;

0 commit comments

Comments
 (0)