From 6002ef2a8f3cf7d1351837582f3cc94489fcc215 Mon Sep 17 00:00:00 2001 From: HTG-YT Date: Sat, 7 Aug 2021 18:41:42 +0800 Subject: [PATCH] add ldexp, ldexpf, lgamma, lgamma_r, lgammaf, lgammaf_r functions --- src/lib.rs | 14 +++++++++++++- src/math/ldexp.rs | 14 ++++++++++++++ src/math/ldexpf.rs | 14 ++++++++++++++ src/math/lgamma.rs | 14 ++++++++++++++ src/math/lgamma_r.rs | 14 ++++++++++++++ src/math/lgammaf.rs | 14 ++++++++++++++ src/math/lgammaf_r.rs | 14 ++++++++++++++ 7 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 src/math/ldexp.rs create mode 100644 src/math/ldexpf.rs create mode 100644 src/math/lgamma.rs create mode 100644 src/math/lgamma_r.rs create mode 100644 src/math/lgammaf.rs create mode 100644 src/math/lgammaf_r.rs diff --git a/src/lib.rs b/src/lib.rs index 4f0625f..a355338 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -133,4 +133,16 @@ pub mod j1f; #[path = "math/jn.rs"] pub mod jn; #[path = "math/jnf.rs"] -pub mod jnf; \ No newline at end of file +pub mod jnf; +#[path = "math/ldexp.rs"] +pub mod ldexp; +#[path = "math/ldexpf.rs"] +pub mod ldexpf; +#[path = "math/lgamma.rs"] +pub mod lgamma; +#[path = "math/lgamma_r.rs"] +pub mod lgamma_r; +#[path = "math/lgammaf.rs"] +pub mod lgammaf; +#[path = "math/lgammaf_r.rs"] +pub mod lgammaf_r; \ No newline at end of file diff --git a/src/math/ldexp.rs b/src/math/ldexp.rs new file mode 100644 index 0000000..15644f8 --- /dev/null +++ b/src/math/ldexp.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/ldexp.rs + * + * The ldexp function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn ldexp(x: f64, n: i32) -> f64 { + libm::ldexp(x, n) +} \ No newline at end of file diff --git a/src/math/ldexpf.rs b/src/math/ldexpf.rs new file mode 100644 index 0000000..e3f179e --- /dev/null +++ b/src/math/ldexpf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/ldexpf.rs + * + * The ldexpf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn ldexpf(x: f32, n: i32) -> f32 { + libm::ldexpf(x, n) +} \ No newline at end of file diff --git a/src/math/lgamma.rs b/src/math/lgamma.rs new file mode 100644 index 0000000..3257b78 --- /dev/null +++ b/src/math/lgamma.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/lgamma.rs + * + * The lgamma function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn lgamma(x: f64) -> f64 { + libm::lgamma(x) +} \ No newline at end of file diff --git a/src/math/lgamma_r.rs b/src/math/lgamma_r.rs new file mode 100644 index 0000000..093ce2d --- /dev/null +++ b/src/math/lgamma_r.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/lgamma_r.rs + * + * The lgamma_r function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn lgamma_r(x: f64) -> (f64, i32) { + libm::lgamma_r(x) +} \ No newline at end of file diff --git a/src/math/lgammaf.rs b/src/math/lgammaf.rs new file mode 100644 index 0000000..1bb0c61 --- /dev/null +++ b/src/math/lgammaf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/lgammaf.rs + * + * The lgammaf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn lgammf(x: f32) -> f32 { + libm::lgammaf(x) +} \ No newline at end of file diff --git a/src/math/lgammaf_r.rs b/src/math/lgammaf_r.rs new file mode 100644 index 0000000..5a65d24 --- /dev/null +++ b/src/math/lgammaf_r.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/lgammaf_r.rs + * + * The lgammaf_r function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn lgammaf_r(x: f32) -> (f32, i32) { + libm::lgammaf_r(x) +} \ No newline at end of file