Add a utility crate for quick evaluation
Introduce a simple binary that can run arbitrary input against any of
the available implementations (musl, MPFR, our libm). This provides an
easy way to check results, or run specific cases against a debugger.
Examples:
$ cargo run -p util -- eval libm pow 1.6 2.4
3.089498284311124
$ cargo run -p util -- eval mpfr pow 1.6 2.4
3.089498284311124
$ cargo run -p util -- eval musl tgamma 1.2344597839132
0.9097442657960874
$ cargo run -p util -- eval mpfr tgamma 1.2344597839132
0.9097442657960874
$ cargo run -p util -- eval libm tgamma 1.2344597839132
0.9097442657960871
$ cargo run -p util -- eval musl sincos 3.1415926535
(8.979318433952318e-11, -1.0)
This commit is contained in:
committed by
Trevor Gross
parent
4d973b6144
commit
dfa694a8e4
@@ -471,6 +471,32 @@ impl MpOp for crate::op::lgammaf_r::Routine {
|
||||
}
|
||||
}
|
||||
|
||||
/* stub implementations so we don't need to special case them */
|
||||
|
||||
impl MpOp for crate::op::nextafter::Routine {
|
||||
type MpTy = MpFloat;
|
||||
|
||||
fn new_mp() -> Self::MpTy {
|
||||
unimplemented!("nextafter does not yet have a MPFR operation");
|
||||
}
|
||||
|
||||
fn run(_this: &mut Self::MpTy, _input: Self::RustArgs) -> Self::RustRet {
|
||||
unimplemented!("nextafter does not yet have a MPFR operation");
|
||||
}
|
||||
}
|
||||
|
||||
impl MpOp for crate::op::nextafterf::Routine {
|
||||
type MpTy = MpFloat;
|
||||
|
||||
fn new_mp() -> Self::MpTy {
|
||||
unimplemented!("nextafter does not yet have a MPFR operation");
|
||||
}
|
||||
|
||||
fn run(_this: &mut Self::MpTy, _input: Self::RustArgs) -> Self::RustRet {
|
||||
unimplemented!("nextafter does not yet have a MPFR operation");
|
||||
}
|
||||
}
|
||||
|
||||
/// `rug` does not provide `remquo` so this exposes `mpfr_remquo`. See rug#76.
|
||||
fn mpfr_remquo(r: &mut MpFloat, x: &MpFloat, y: &MpFloat, round: Round) -> (Ordering, c_long) {
|
||||
let r = r.as_raw_mut();
|
||||
|
||||
Reference in New Issue
Block a user