Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 31d9d12

Browse files
committed
Re-enable lgamma_r
1 parent a1ccd8a commit 31d9d12

File tree

2 files changed

+30
-24
lines changed

2 files changed

+30
-24
lines changed

crates/libm-test/src/mpfloat.rs

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -274,23 +274,33 @@ macro_rules! impl_op_for_ty {
274274
impl_op_for_ty!(f32, "f");
275275
impl_op_for_ty!(f64, "");
276276

277-
// TODO can't just use a suffix
278-
// Account for `lgamma_r` not having a simple `f` suffix
279-
// pub mod lgammaf_r {
280-
// pub use super::lgamma_rf::*;
281-
// }
282-
283-
// impl MpOp for crate::func::[<lgamma_r $suffix>]::Func {
284-
// type MpTy = MpFloat;
285-
286-
// fn new_mp() -> Self::MpTy {
287-
// new_mpfloat::<Self::FTy>()
288-
// }
289-
290-
// fn run(this: &mut Self::MpTy, input: Self::RustArgs) -> Self::RustRet {
291-
// this.assign(input.0);
292-
// let (sign, ord) = this.ln_abs_gamma_round(Nearest);
293-
// let ret = prep_retval::<Self::FTy>(this, ord);
294-
// (ret, sign as i32)
295-
// }
296-
// }
277+
// `lgamma_r` is not a simple suffix so we can't use the above macro.
278+
impl MpOp for crate::func::lgamma_r::Func {
279+
type MpTy = MpFloat;
280+
281+
fn new_mp() -> Self::MpTy {
282+
new_mpfloat::<Self::FTy>()
283+
}
284+
285+
fn run(this: &mut Self::MpTy, input: Self::RustArgs) -> Self::RustRet {
286+
this.assign(input.0);
287+
let (sign, ord) = this.ln_abs_gamma_round(Nearest);
288+
let ret = prep_retval::<Self::FTy>(this, ord);
289+
(ret, sign as i32)
290+
}
291+
}
292+
293+
impl MpOp for crate::func::lgammaf_r::Func {
294+
type MpTy = MpFloat;
295+
296+
fn new_mp() -> Self::MpTy {
297+
new_mpfloat::<Self::FTy>()
298+
}
299+
300+
fn run(this: &mut Self::MpTy, input: Self::RustArgs) -> Self::RustRet {
301+
this.assign(input.0);
302+
let (sign, ord) = this.ln_abs_gamma_round(Nearest);
303+
let ret = prep_retval::<Self::FTy>(this, ord);
304+
(ret, sign as i32)
305+
}
306+
}

crates/libm-test/tests/multiprecision.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,5 @@ libm_macros::for_each_function! {
7171
// https://github.com/rust-lang/libm/pull/311#discussion_r1818273392
7272
nextafter,
7373
nextafterf,
74-
75-
// TODO: impl in module
76-
lgamma_r,
77-
lgammaf_r,
7874
],
7975
}

0 commit comments

Comments
 (0)