From 8f5262c715c2abc4f7ebcbf16f52812af1b6923c Mon Sep 17 00:00:00 2001 From: HTG-YT Date: Sat, 7 Aug 2021 19:26:35 +0800 Subject: [PATCH] add modf, modff, nextafter, nextafterf functions --- src/lib.rs | 10 +++++++++- src/math/modf.rs | 14 ++++++++++++++ src/math/modff.rs | 14 ++++++++++++++ src/math/nextafter.rs | 14 ++++++++++++++ src/math/nextafterf.rs | 14 ++++++++++++++ 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 src/math/modf.rs create mode 100644 src/math/modff.rs create mode 100644 src/math/nextafter.rs create mode 100644 src/math/nextafterf.rs diff --git a/src/lib.rs b/src/lib.rs index 3a2a299..3f71698 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -161,4 +161,12 @@ pub mod log10; #[path = "math/log10f.rs"] pub mod log10f; #[path = "math/logf.rs"] -pub mod logf; \ No newline at end of file +pub mod logf; +#[path = "math/modf.rs"] +pub mod modf; +#[path = "math/modff.rs"] +pub mod modff; +#[path = "math/nextafter.rs"] +pub mod nextafter; +#[path = "math/nextafterf.rs"] +pub mod nextafterf; \ No newline at end of file diff --git a/src/math/modf.rs b/src/math/modf.rs new file mode 100644 index 0000000..6248ba8 --- /dev/null +++ b/src/math/modf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/modf.rs + * + * The modf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn modf(x: f64) -> (f64, f64) { + libm::modf(x) +} \ No newline at end of file diff --git a/src/math/modff.rs b/src/math/modff.rs new file mode 100644 index 0000000..bc86820 --- /dev/null +++ b/src/math/modff.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/modff.rs + * + * The modff function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn modff(x: f32) -> (f32, f32) { + libm::modff(x) +} \ No newline at end of file diff --git a/src/math/nextafter.rs b/src/math/nextafter.rs new file mode 100644 index 0000000..831b9d9 --- /dev/null +++ b/src/math/nextafter.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/nextafter.rs + * + * The nextafter function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn nextafter(x: f64, y: f64) -> f64 { + libm::nextafter(x, y) +} \ No newline at end of file diff --git a/src/math/nextafterf.rs b/src/math/nextafterf.rs new file mode 100644 index 0000000..508723e --- /dev/null +++ b/src/math/nextafterf.rs @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MPL-2.0 +/* + * File: src/math/nextafterf.rs + * + * The nextafterf function. + * + * Author: HTG-YT + * Copyright (c) 2021 The LibM Team of the HaruxOS Project + */ + +#[no_mangle] +pub extern "C" fn nextafterf(x: f32, y: f32) -> f32 { + libm::nextafterf(x, y) +} \ No newline at end of file