add fabs, fabsf, fdim, fdimf functions

This commit is contained in:
HTG-YT 2021-08-07 14:17:52 +08:00
parent 4421b24126
commit 276f755737
5 changed files with 65 additions and 1 deletions

View file

@ -82,3 +82,11 @@ pub mod expf;
pub mod expm1;
#[path = "math/expm1f.rs"]
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)
}