From 22890781eb63ef334ea4467f36d9c357285cbd54 Mon Sep 17 00:00:00 2001 From: HTG-YT Date: Sat, 7 Aug 2021 18:57:08 +0800 Subject: [PATCH] add log, log10, log10f, log1p, log1pf, log2, log2f, logf functions --- src/lib.rs | 18 +++++++++++++++++- src/math/log.rs | 14 ++++++++++++++ src/math/log10.rs | 14 ++++++++++++++ src/math/log10f.rs | 14 ++++++++++++++ src/math/log1p.rs | 14 ++++++++++++++ src/math/log1pf.rs | 14 ++++++++++++++ src/math/log2.rs | 14 ++++++++++++++ src/math/log2f.rs | 14 ++++++++++++++ src/math/logf.rs | 14 ++++++++++++++ 9 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 src/math/log.rs create mode 100644 src/math/log10.rs create mode 100644 src/math/log10f.rs create mode 100644 src/math/log1p.rs create mode 100644 src/math/log1pf.rs create mode 100644 src/math/log2.rs create mode 100644 src/math/log2f.rs create mode 100644 src/math/logf.rs diff --git a/src/lib.rs b/src/lib.rs index a355338..3a2a299 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -145,4 +145,20 @@ 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 +pub mod lgammaf_r; +#[path = "math/log.rs"] +pub mod log; +#[path = "math/log1p.rs"] +pub mod log1p; +#[path = "math/log1pf.rs"] +pub mod log1pf; +#[path = "math/log2.rs"] +pub mod log2; +#[path = "math/log2f.rs"] +pub mod log2f; +#[path = "math/log10.rs"] +pub mod log10; +#[path = "math/log10f.rs"] +pub mod log10f; +#[path = "math/logf.rs"] +pub mod logf; \ No newline at end of file diff --git a/src/math/log.rs b/src/math/log.rs new file mode 100644 index 0000000..4e3998f --- /dev/null +++ b/src/math/log.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/log.rs + * + * The log function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn log(x: f64) -> f64 { + libm::log(x) +} \ No newline at end of file diff --git a/src/math/log10.rs b/src/math/log10.rs new file mode 100644 index 0000000..9cd2ffb --- /dev/null +++ b/src/math/log10.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/log10.rs + * + * The log10 function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn log10(x: f64) -> f64 { + libm::log10(x) +} \ No newline at end of file diff --git a/src/math/log10f.rs b/src/math/log10f.rs new file mode 100644 index 0000000..814c30f --- /dev/null +++ b/src/math/log10f.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/log10f.rs + * + * The log10f function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn log10f(x: f32) -> f32 { + libm::log10f(x) +} \ No newline at end of file diff --git a/src/math/log1p.rs b/src/math/log1p.rs new file mode 100644 index 0000000..db0c2db --- /dev/null +++ b/src/math/log1p.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/log1p.rs + * + * The log1p function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn log1p(x: f64) -> f64 { + libm::log1p(x) +} \ No newline at end of file diff --git a/src/math/log1pf.rs b/src/math/log1pf.rs new file mode 100644 index 0000000..41f9741 --- /dev/null +++ b/src/math/log1pf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/log1pf.rs + * + * The log1pf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn log1pf(x: f32) -> f32 { + libm::log1pf(x) +} \ No newline at end of file diff --git a/src/math/log2.rs b/src/math/log2.rs new file mode 100644 index 0000000..9524985 --- /dev/null +++ b/src/math/log2.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/log2.rs + * + * The log2 function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn log2(x: f64) -> f64 { + libm::log2(x) +} \ No newline at end of file diff --git a/src/math/log2f.rs b/src/math/log2f.rs new file mode 100644 index 0000000..dc8ea5a --- /dev/null +++ b/src/math/log2f.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/log2f.rs + * + * The log2f function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn log2f(x: f32) -> f32 { + libm::log2f(x) +} \ No newline at end of file diff --git a/src/math/logf.rs b/src/math/logf.rs new file mode 100644 index 0000000..3ba0bc6 --- /dev/null +++ b/src/math/logf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/logf.rs + * + * The logf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn logf(x: f32) -> f32 { + libm::logf(x) +} \ No newline at end of file