From 052849680bf87631738874e980d07e53927c9bd7 Mon Sep 17 00:00:00 2001 From: HTG-YT Date: Sat, 7 Aug 2021 20:11:24 +0800 Subject: [PATCH] add pow, powf, remainder, remainderf, remquo, remquof, round, roundf, scalbn, scalbnf, sin, sincos, sincosf, sinf, sinh, sinhf, sqrt, sqrtf, tan, tanf, tanh, tanhf, tgamma, tgammaf, trunc, truncf, y0, y0f, y1, y1f, yn, ynf functions --- src/lib.rs | 66 +++++++++++++++++++++++++++++++++++++++++- src/math/pow.rs | 14 +++++++++ src/math/powf.rs | 14 +++++++++ src/math/remainder.rs | 14 +++++++++ src/math/remainderf.rs | 14 +++++++++ src/math/remquo.rs | 14 +++++++++ src/math/remquof.rs | 14 +++++++++ src/math/round.rs | 14 +++++++++ src/math/roundf.rs | 14 +++++++++ src/math/scalbn.rs | 14 +++++++++ src/math/scalbnf.rs | 14 +++++++++ src/math/sin.rs | 14 +++++++++ src/math/sincos.rs | 14 +++++++++ src/math/sincosf.rs | 14 +++++++++ src/math/sinf.rs | 14 +++++++++ src/math/sinh.rs | 14 +++++++++ src/math/sinhf.rs | 14 +++++++++ src/math/sqrt.rs | 14 +++++++++ src/math/sqrtf.rs | 14 +++++++++ src/math/tan.rs | 14 +++++++++ src/math/tanf.rs | 14 +++++++++ src/math/tanh.rs | 14 +++++++++ src/math/tanhf.rs | 14 +++++++++ src/math/tgamma.rs | 14 +++++++++ src/math/tgammaf.rs | 14 +++++++++ src/math/trunc.rs | 14 +++++++++ src/math/truncf.rs | 14 +++++++++ src/math/y0.rs | 14 +++++++++ src/math/y0f.rs | 14 +++++++++ src/math/y1.rs | 14 +++++++++ src/math/y1f.rs | 14 +++++++++ src/math/yn.rs | 14 +++++++++ src/math/ynf.rs | 14 +++++++++ 33 files changed, 513 insertions(+), 1 deletion(-) create mode 100644 src/math/pow.rs create mode 100644 src/math/powf.rs create mode 100644 src/math/remainder.rs create mode 100644 src/math/remainderf.rs create mode 100644 src/math/remquo.rs create mode 100644 src/math/remquof.rs create mode 100644 src/math/round.rs create mode 100644 src/math/roundf.rs create mode 100644 src/math/scalbn.rs create mode 100644 src/math/scalbnf.rs create mode 100644 src/math/sin.rs create mode 100644 src/math/sincos.rs create mode 100644 src/math/sincosf.rs create mode 100644 src/math/sinf.rs create mode 100644 src/math/sinh.rs create mode 100644 src/math/sinhf.rs create mode 100644 src/math/sqrt.rs create mode 100644 src/math/sqrtf.rs create mode 100644 src/math/tan.rs create mode 100644 src/math/tanf.rs create mode 100644 src/math/tanh.rs create mode 100644 src/math/tanhf.rs create mode 100644 src/math/tgamma.rs create mode 100644 src/math/tgammaf.rs create mode 100644 src/math/trunc.rs create mode 100644 src/math/truncf.rs create mode 100644 src/math/y0.rs create mode 100644 src/math/y0f.rs create mode 100644 src/math/y1.rs create mode 100644 src/math/y1f.rs create mode 100644 src/math/yn.rs create mode 100644 src/math/ynf.rs diff --git a/src/lib.rs b/src/lib.rs index 3f71698..6cd85f4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -169,4 +169,68 @@ pub mod modff; #[path = "math/nextafter.rs"] pub mod nextafter; #[path = "math/nextafterf.rs"] -pub mod nextafterf; \ No newline at end of file +pub mod nextafterf; +#[path = "math/pow.rs"] +pub mod pow; +#[path = "math/powf.rs"] +pub mod powf; +#[path = "math/remainder.rs"] +pub mod remainder; +#[path = "math/remainderf.rs"] +pub mod remainderf; +#[path = "math/remquo.rs"] +pub mod remquo; +#[path = "math/remquof.rs"] +pub mod remquof; +#[path = "math/round.rs"] +pub mod round; +#[path = "math/roundf.rs"] +pub mod roundf; +#[path = "math/scalbn.rs"] +pub mod scalbn; +#[path = "math/scalbnf.rs"] +pub mod scalbnf; +#[path = "math/sin.rs"] +pub mod sin; +#[path = "math/sincos.rs"] +pub mod sincos; +#[path = "math/sincosf.rs"] +pub mod sincosf; +#[path = "math/sinf.rs"] +pub mod sinf; +#[path = "math/sinh.rs"] +pub mod sinh; +#[path = "math/sinhf.rs"] +pub mod sinhf; +#[path = "math/sqrt.rs"] +pub mod sqrt; +#[path = "math/sqrtf.rs"] +pub mod sqrtf; +#[path = "math/tan.rs"] +pub mod tan; +#[path = "math/tanf.rs"] +pub mod tanf; +#[path = "math/tanh.rs"] +pub mod tanh; +#[path = "math/tanhf.rs"] +pub mod tanhf; +#[path = "math/tgamma.rs"] +pub mod tgamma; +#[path = "math/tgammaf.rs"] +pub mod tgammaf; +#[path = "math/trunc.rs"] +pub mod trunc; +#[path = "math/truncf.rs"] +pub mod truncf; +#[path = "math/y0.rs"] +pub mod y0; +#[path = "math/y0f.rs"] +pub mod y0f; +#[path = "math/y1.rs"] +pub mod y1; +#[path = "math/y1f.rs"] +pub mod y1f; +#[path = "math/yn.rs"] +pub mod yn; +#[path = "math/ynf.rs"] +pub mod ynf; \ No newline at end of file diff --git a/src/math/pow.rs b/src/math/pow.rs new file mode 100644 index 0000000..cca0eb7 --- /dev/null +++ b/src/math/pow.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/pow.rs + * + * The pow function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn pow(x: f64, y: f64) -> f64 { + libm::pow(x, y) +} \ No newline at end of file diff --git a/src/math/powf.rs b/src/math/powf.rs new file mode 100644 index 0000000..f13db22 --- /dev/null +++ b/src/math/powf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/powf.rs + * + * The powf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn powf(x: f32, y: f32) -> f32 { + libm::powf(x, y) +} \ No newline at end of file diff --git a/src/math/remainder.rs b/src/math/remainder.rs new file mode 100644 index 0000000..6d0f2ab --- /dev/null +++ b/src/math/remainder.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/remainder.rs + * + * The remainder function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn remainder(x: f64, y: f64) -> f64 { + libm::remainder(x, y) +} \ No newline at end of file diff --git a/src/math/remainderf.rs b/src/math/remainderf.rs new file mode 100644 index 0000000..2e801db --- /dev/null +++ b/src/math/remainderf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/remainderf.rs + * + * The remainderf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn remainderf(x: f32, y: f32) -> f32 { + libm::remainderf(x, y) +} \ No newline at end of file diff --git a/src/math/remquo.rs b/src/math/remquo.rs new file mode 100644 index 0000000..31259dc --- /dev/null +++ b/src/math/remquo.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/remquo.rs + * + * The remquo function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn remquo(x: f64, y: f64) -> (f64, i32) { + libm::remquo(x, y) +} \ No newline at end of file diff --git a/src/math/remquof.rs b/src/math/remquof.rs new file mode 100644 index 0000000..52f1811 --- /dev/null +++ b/src/math/remquof.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/remquof.rs + * + * The remquof function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn remquof(x: f32, y: f32) -> (f32, i32) { + libm::remquof(x, y) +} \ No newline at end of file diff --git a/src/math/round.rs b/src/math/round.rs new file mode 100644 index 0000000..0e3d4a3 --- /dev/null +++ b/src/math/round.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/round.rs + * + * The round function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn round(x: f64) -> f64 { + libm::round(x) +} \ No newline at end of file diff --git a/src/math/roundf.rs b/src/math/roundf.rs new file mode 100644 index 0000000..af0d5bb --- /dev/null +++ b/src/math/roundf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/roundf.rs + * + * The roundf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn roundf(x: f32) -> f32 { + libm::roundf(x) +} \ No newline at end of file diff --git a/src/math/scalbn.rs b/src/math/scalbn.rs new file mode 100644 index 0000000..c01a6c0 --- /dev/null +++ b/src/math/scalbn.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/scalbn.rs + * + * The scalbn function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn scalbn(x: f64, n: i32) -> f64 { + libm::scalbn(x, n) +} \ No newline at end of file diff --git a/src/math/scalbnf.rs b/src/math/scalbnf.rs new file mode 100644 index 0000000..ab49a04 --- /dev/null +++ b/src/math/scalbnf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/scalbnf.rs + * + * The scalbnf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn scalbnf(x: f32, n: i32) -> f32 { + libm::scalbnf(x, n) +} \ No newline at end of file diff --git a/src/math/sin.rs b/src/math/sin.rs new file mode 100644 index 0000000..3afec2e --- /dev/null +++ b/src/math/sin.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/sin.rs + * + * The sin function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn sin(x: f64) -> f64 { + libm::sin(x) +} \ No newline at end of file diff --git a/src/math/sincos.rs b/src/math/sincos.rs new file mode 100644 index 0000000..2a6bad7 --- /dev/null +++ b/src/math/sincos.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/sincos.rs + * + * The sincos function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn sincos(x: f64) -> (f64, f64) { + libm::sincos(x) +} \ No newline at end of file diff --git a/src/math/sincosf.rs b/src/math/sincosf.rs new file mode 100644 index 0000000..9caa222 --- /dev/null +++ b/src/math/sincosf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/sincosf.rs + * + * The sincosf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn sincosf(x: f32) -> (f32, f32) { + libm::sincosf(x) +} \ No newline at end of file diff --git a/src/math/sinf.rs b/src/math/sinf.rs new file mode 100644 index 0000000..1047e57 --- /dev/null +++ b/src/math/sinf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/sinf.rs + * + * The sinf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn sinf(x: f32) -> f32 { + libm::sinf(x) +} \ No newline at end of file diff --git a/src/math/sinh.rs b/src/math/sinh.rs new file mode 100644 index 0000000..d50e2be --- /dev/null +++ b/src/math/sinh.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/sinh.rs + * + * The sinh function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn sinh(x: f64) -> f64 { + libm::sinh(x) +} \ No newline at end of file diff --git a/src/math/sinhf.rs b/src/math/sinhf.rs new file mode 100644 index 0000000..e7d96db --- /dev/null +++ b/src/math/sinhf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/sinhf.rs + * + * The sinhf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn sinhf(x: f32) -> f32 { + libm::sinhf(x) +} \ No newline at end of file diff --git a/src/math/sqrt.rs b/src/math/sqrt.rs new file mode 100644 index 0000000..d493415 --- /dev/null +++ b/src/math/sqrt.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/sqrt.rs + * + * The sqrt function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn sqrt(x: f64) -> f64 { + libm::sqrt(x) +} \ No newline at end of file diff --git a/src/math/sqrtf.rs b/src/math/sqrtf.rs new file mode 100644 index 0000000..bab565f --- /dev/null +++ b/src/math/sqrtf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/sqrtf.rs + * + * The sqrtf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn sqrtf(x: f32) -> f32 { + libm::sqrtf(x) +} \ No newline at end of file diff --git a/src/math/tan.rs b/src/math/tan.rs new file mode 100644 index 0000000..8d8abf6 --- /dev/null +++ b/src/math/tan.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/tan.rs + * + * The tan function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn tan(x: f64) -> f64 { + libm::tan(x) +} \ No newline at end of file diff --git a/src/math/tanf.rs b/src/math/tanf.rs new file mode 100644 index 0000000..417f1ab --- /dev/null +++ b/src/math/tanf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/tanf.rs + * + * The tanf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn tanf(x: f32) -> f32 { + libm::tanf(x) +} \ No newline at end of file diff --git a/src/math/tanh.rs b/src/math/tanh.rs new file mode 100644 index 0000000..0bacceb --- /dev/null +++ b/src/math/tanh.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/tanh.rs + * + * The tanh function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn tanh(x: f64) -> f64 { + libm::tanh(x) +} \ No newline at end of file diff --git a/src/math/tanhf.rs b/src/math/tanhf.rs new file mode 100644 index 0000000..e130a24 --- /dev/null +++ b/src/math/tanhf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/tanhf.rs + * + * The tanhf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn tanhf(x: f32) -> f32 { + libm::tanhf(x) +} \ No newline at end of file diff --git a/src/math/tgamma.rs b/src/math/tgamma.rs new file mode 100644 index 0000000..8b49d57 --- /dev/null +++ b/src/math/tgamma.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/tgamma.rs + * + * The tgamma function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn tgamma(x: f64) -> f64 { + libm::tgamma(x) +} \ No newline at end of file diff --git a/src/math/tgammaf.rs b/src/math/tgammaf.rs new file mode 100644 index 0000000..b0b9626 --- /dev/null +++ b/src/math/tgammaf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/tgammaf.rs + * + * The tgammaf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn tgammaf(x: f32) -> f32 { + libm::tgammaf(x) +} \ No newline at end of file diff --git a/src/math/trunc.rs b/src/math/trunc.rs new file mode 100644 index 0000000..7e06470 --- /dev/null +++ b/src/math/trunc.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/trunc.rs + * + * The trunc function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn trunc(x: f64) -> f64 { + libm::trunc(x) +} \ No newline at end of file diff --git a/src/math/truncf.rs b/src/math/truncf.rs new file mode 100644 index 0000000..2427792 --- /dev/null +++ b/src/math/truncf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/truncf.rs + * + * The truncf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn truncf(x: f32) -> f32 { + libm::truncf(x) +} \ No newline at end of file diff --git a/src/math/y0.rs b/src/math/y0.rs new file mode 100644 index 0000000..cfa48f0 --- /dev/null +++ b/src/math/y0.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/y0.rs + * + * The y0 function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn y0(x: f64) -> f64 { + libm::y0(x) +} \ No newline at end of file diff --git a/src/math/y0f.rs b/src/math/y0f.rs new file mode 100644 index 0000000..81c3e13 --- /dev/null +++ b/src/math/y0f.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/y0f.rs + * + * The y0f function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn y0f(x: f32) -> f32 { + libm::y0f(x) +} \ No newline at end of file diff --git a/src/math/y1.rs b/src/math/y1.rs new file mode 100644 index 0000000..e3ee78e --- /dev/null +++ b/src/math/y1.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/y1.rs + * + * The y1 function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn y1(x: f64) -> f64 { + libm::y1(x) +} \ No newline at end of file diff --git a/src/math/y1f.rs b/src/math/y1f.rs new file mode 100644 index 0000000..9e8f44e --- /dev/null +++ b/src/math/y1f.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/y1f.rs + * + * The y1f function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn y1f(x: f32) -> f32 { + libm::y1f(x) +} \ No newline at end of file diff --git a/src/math/yn.rs b/src/math/yn.rs new file mode 100644 index 0000000..0af3353 --- /dev/null +++ b/src/math/yn.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/yn.rs + * + * The yn function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn yn(n: i32, x: f64) -> f64 { + libm::yn(n, x) +} \ No newline at end of file diff --git a/src/math/ynf.rs b/src/math/ynf.rs new file mode 100644 index 0000000..ab314ad --- /dev/null +++ b/src/math/ynf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/ynf.rs + * + * The ynf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn ynf(n: i32, x: f32) -> f32 { + libm::ynf(n, x) +} \ No newline at end of file