Add missing functions to the macro list
Now that we are using rustdoc output to locate public functions, the test is indicating a few that were missed since they don't have their own function. Update everything to now include the following routines: * `erfc` * `erfcf` * `y0` * `y0f` * `y1` * `y1f` * `yn` * `ynf`
This commit is contained in:
parent
ed72c4ec69
commit
e754ecb6d9
7 changed files with 42 additions and 19 deletions
|
|
@ -11,9 +11,9 @@ const ALL_OPERATIONS_NESTED: &[(FloatTy, Signature, Option<Signature>, &[&str])]
|
|||
None,
|
||||
&[
|
||||
"acosf", "acoshf", "asinf", "asinhf", "atanf", "atanhf", "cbrtf", "ceilf", "cosf",
|
||||
"coshf", "erff", "exp10f", "exp2f", "expf", "expm1f", "fabsf", "floorf", "j0f", "j1f",
|
||||
"lgammaf", "log10f", "log1pf", "log2f", "logf", "rintf", "roundf", "sinf", "sinhf",
|
||||
"sqrtf", "tanf", "tanhf", "tgammaf", "truncf",
|
||||
"coshf", "erff", "erfcf", "exp10f", "exp2f", "expf", "expm1f", "fabsf", "floorf",
|
||||
"j0f", "j1f", "lgammaf", "log10f", "log1pf", "log2f", "logf", "rintf", "roundf",
|
||||
"sinf", "sinhf", "sqrtf", "tanf", "tanhf", "tgammaf", "truncf", "y0f", "y1f",
|
||||
],
|
||||
),
|
||||
(
|
||||
|
|
@ -23,9 +23,9 @@ const ALL_OPERATIONS_NESTED: &[(FloatTy, Signature, Option<Signature>, &[&str])]
|
|||
None,
|
||||
&[
|
||||
"acos", "acosh", "asin", "asinh", "atan", "atanh", "cbrt", "ceil", "cos", "cosh",
|
||||
"erf", "exp10", "exp2", "exp", "expm1", "fabs", "floor", "j0", "j1", "lgamma", "log10",
|
||||
"log1p", "log2", "log", "rint", "round", "sin", "sinh", "sqrt", "tan", "tanh",
|
||||
"tgamma", "trunc",
|
||||
"erf", "erfc", "exp10", "exp2", "exp", "expm1", "fabs", "floor", "j0", "j1", "lgamma",
|
||||
"log10", "log1p", "log2", "log", "rint", "round", "sin", "sinh", "sqrt", "tan", "tanh",
|
||||
"tgamma", "trunc", "y0", "y1",
|
||||
],
|
||||
),
|
||||
(
|
||||
|
|
@ -97,14 +97,14 @@ const ALL_OPERATIONS_NESTED: &[(FloatTy, Signature, Option<Signature>, &[&str])]
|
|||
FloatTy::F32,
|
||||
Signature { args: &[Ty::I32, Ty::F32], returns: &[Ty::F32] },
|
||||
None,
|
||||
&["jnf"],
|
||||
&["jnf", "ynf"],
|
||||
),
|
||||
(
|
||||
// `(i32, f64) -> f64`
|
||||
FloatTy::F64,
|
||||
Signature { args: &[Ty::I32, Ty::F64], returns: &[Ty::F64] },
|
||||
None,
|
||||
&["jn"],
|
||||
&["jn", "yn"],
|
||||
),
|
||||
(
|
||||
// `(f32, i32) -> f32`
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ impl_has_domain! {
|
|||
cos => TRIG;
|
||||
cosh => UNBOUNDED;
|
||||
erf => UNBOUNDED;
|
||||
erfc => UNBOUNDED;
|
||||
exp => UNBOUNDED;
|
||||
exp10 => UNBOUNDED;
|
||||
exp2 => UNBOUNDED;
|
||||
|
|
@ -173,6 +174,8 @@ impl_has_domain! {
|
|||
tanh => UNBOUNDED;
|
||||
tgamma => GAMMA;
|
||||
trunc => UNBOUNDED;
|
||||
y0 => UNBOUNDED;
|
||||
y1 => UNBOUNDED;
|
||||
}
|
||||
|
||||
/* Manual implementations, these functions don't follow `foo`->`foof` naming */
|
||||
|
|
|
|||
|
|
@ -110,6 +110,10 @@ pub fn get_test_cases<RustArgs>(ctx: &CheckCtx) -> impl Iterator<Item = RustArgs
|
|||
where
|
||||
CachedInput: GenerateInput<RustArgs>,
|
||||
{
|
||||
let inputs = if ctx.base_name == BaseName::Jn { &TEST_CASES_JN } else { &TEST_CASES };
|
||||
let inputs = if ctx.base_name == BaseName::Jn || ctx.base_name == BaseName::Yn {
|
||||
&TEST_CASES_JN
|
||||
} else {
|
||||
&TEST_CASES
|
||||
};
|
||||
inputs.get_cases()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ libm_macros::for_each_function! {
|
|||
fabsf, ceilf, copysignf, floorf, rintf, roundf, truncf,
|
||||
fmod, fmodf, frexp, frexpf, ilogb, ilogbf, jn, jnf, ldexp, ldexpf,
|
||||
lgamma_r, lgammaf_r, modf, modff, nextafter, nextafterf, pow,powf,
|
||||
remquo, remquof, scalbn, scalbnf, sincos, sincosf,
|
||||
remquo, remquof, scalbn, scalbnf, sincos, sincosf, yn, ynf,
|
||||
],
|
||||
fn_extra: match MACRO_FN_NAME {
|
||||
// Remap function names that are different between mpfr and libm
|
||||
|
|
@ -266,6 +266,21 @@ macro_rules! impl_op_for_ty {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl MpOp for crate::op::[<yn $suffix>]::Routine {
|
||||
type MpTy = (i32, MpFloat);
|
||||
|
||||
fn new_mp() -> Self::MpTy {
|
||||
(0, new_mpfloat::<Self::FTy>())
|
||||
}
|
||||
|
||||
fn run(this: &mut Self::MpTy, input: Self::RustArgs) -> Self::RustRet {
|
||||
this.0 = input.0;
|
||||
this.1.assign(input.1);
|
||||
let ord = this.1.yn_round(this.0, Nearest);
|
||||
prep_retval::<Self::FTy>(&mut this.1, ord)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,11 +26,9 @@ pub fn default_ulp(ctx: &CheckCtx) -> u32 {
|
|||
// Overrides that apply to either basis
|
||||
// FMA is expected to be infinite precision.
|
||||
(_, Id::Fma | Id::Fmaf) => 0,
|
||||
(_, Id::J0 | Id::J0f | Id::J1 | Id::J1f) => {
|
||||
// Results seem very target-dependent
|
||||
if cfg!(target_arch = "x86_64") { 4000 } else { 800_000 }
|
||||
}
|
||||
(_, Id::Jn | Id::Jnf) => 1000,
|
||||
(_, Id::J0 | Id::J0f | Id::J1 | Id::J1f | Id::Y0 | Id::Y0f | Id::Y1 | Id::Y1f) => 800_000,
|
||||
(_, Id::Jn | Id::Jnf | Id::Yn | Id::Ynf) => 1000,
|
||||
(_, Id::Erfc | Id::Erfcf) => 4,
|
||||
|
||||
// Overrides for musl
|
||||
#[cfg(x86_no_sse)]
|
||||
|
|
@ -297,7 +295,7 @@ impl MaybeOverride<(i32, f32)> for SpecialCase {
|
|||
(Musl, _) => bessel_prec_dropoff(input, ulp, ctx),
|
||||
|
||||
// We return +0.0, MPFR returns -0.0
|
||||
(Mpfr, BaseName::Jn)
|
||||
(Mpfr, BaseName::Jn | BaseName::Yn)
|
||||
if input.1 == f32::NEG_INFINITY && actual == F::ZERO && expected == F::ZERO =>
|
||||
{
|
||||
XFAIL
|
||||
|
|
@ -319,7 +317,7 @@ impl MaybeOverride<(i32, f64)> for SpecialCase {
|
|||
(Musl, _) => bessel_prec_dropoff(input, ulp, ctx),
|
||||
|
||||
// We return +0.0, MPFR returns -0.0
|
||||
(Mpfr, BaseName::Jn)
|
||||
(Mpfr, BaseName::Jn | BaseName::Yn)
|
||||
if input.1 == f64::NEG_INFINITY && actual == F::ZERO && expected == F::ZERO =>
|
||||
{
|
||||
XFAIL
|
||||
|
|
@ -336,7 +334,7 @@ fn bessel_prec_dropoff<F: Float>(
|
|||
ulp: &mut u32,
|
||||
ctx: &CheckCtx,
|
||||
) -> Option<TestResult> {
|
||||
if ctx.base_name == BaseName::Jn {
|
||||
if ctx.base_name == BaseName::Jn || ctx.base_name == BaseName::Yn {
|
||||
if input.0 > 4000 {
|
||||
return XFAIL;
|
||||
} else if input.0 > 2000 {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ libm_macros::for_each_function! {
|
|||
attributes: [
|
||||
// Also an assertion failure on i686: at `MPFR_ASSERTN (! mpfr_erangeflag_p ())`
|
||||
#[ignore = "large values are infeasible in MPFR"]
|
||||
[jn, jnf],
|
||||
[jn, jnf, yn, ynf],
|
||||
],
|
||||
skip: [
|
||||
// FIXME: MPFR tests needed
|
||||
|
|
@ -157,6 +157,8 @@ libm_macros::for_each_function! {
|
|||
remquof,
|
||||
scalbn,
|
||||
scalbnf,
|
||||
yn,
|
||||
ynf,
|
||||
|
||||
// FIXME: MPFR tests needed
|
||||
frexp,
|
||||
|
|
|
|||
|
|
@ -282,5 +282,6 @@ functions! {
|
|||
musl_y0f: y0f(a: f32) -> f32;
|
||||
musl_y1: y1(a: f64) -> f64;
|
||||
musl_y1f: y1f(a: f32) -> f32;
|
||||
musl_yn: yn(a: c_int, b: f64) -> f64;
|
||||
musl_ynf: ynf(a: c_int, b: f32) -> f32;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue