add fabs, fabsf, fdim, fdimf functions

pull/1/head
HTG-YT 2021-08-07 14:17:52 +08:00
parent 2270d7ed2d
commit 096ef095b0
5 changed files with 65 additions and 1 deletions

View File

@ -81,4 +81,12 @@ pub mod expf;
#[path = "math/expm1.rs"]
pub mod expm1;
#[path = "math/expm1f.rs"]
pub mod expm1f;
pub mod expm1f;
#[path = "math/fabs.rs"]
pub mod fabs;
#[path = "math/fabsf.rs"]
pub mod fabsf;
#[path = "math/fdim.rs"]
pub mod fdim;
#[path = "math/fdimf.rs"]
pub mod fdimf;

14
src/math/fabs.rs Normal file
View File

@ -0,0 +1,14 @@
// SPDX-License-Identifier: MPL-2.0
/*
* File: src/math/fabs.rs
*
* The fabs function.
*
* Author: HTG-YT
* Copyright (c) 2021 The LibM Team of the HaruxOS Project
*/
#[no_mangle]
pub extern "C" fn fabs(x: f64) -> f64 {
libm::fabs(x)
}

14
src/math/fabsf.rs Normal file
View File

@ -0,0 +1,14 @@
// SPDX-License-Identifier: MPL-2.0
/*
* File: src/math/fabsf.rs
*
* The fabsf function.
*
* Author: HTG-YT
* Copyright (c) 2021 The LibM Team of the HaruxOS Project
*/
#[no_mangle]
pub extern "C" fn fabsf(x: f32) -> f32 {
libm::fabsf(x)
}

14
src/math/fdim.rs Normal file
View File

@ -0,0 +1,14 @@
// SPDX-License-Identifier: MPL-2.0
/*
* File: src/math/fdim.rs
*
* The fdim function.
*
* Author: HTG-YT
* Copyright (c) 2021 The LibM Team of the HaruxOS Project
*/
#[no_mangle]
pub extern "C" fn fdim(x: f64, y: f64) -> f64 {
libm::fdim(x, y)
}

14
src/math/fdimf.rs Normal file
View File

@ -0,0 +1,14 @@
// SPDX-License-Identifier: MPL-2.0
/*
* File: src/math/fdimf.rs
*
* The fdimf function.
*
* Author: HTG-YT
* Copyright (c) 2021 The LibM Team of the HaruxOS Project
*/
#[no_mangle]
pub extern "C" fn fdimf(x: f32, y: f32) -> f32 {
libm::fdimf(x, y)
}