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:
Trevor Gross
2024-12-31 22:57:21 +00:00
parent ed72c4ec69
commit e754ecb6d9
7 changed files with 42 additions and 19 deletions

View File

@@ -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 */

View File

@@ -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()
}

View File

@@ -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)
}
}
}
};
}

View File

@@ -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 {