add hypot, hypotf, ilogb, ilogbf functions

This commit is contained in:
HTG-YT 2021-08-07 16:09:03 +08:00
parent bff9ecdaed
commit 8d6b891ddd
5 changed files with 65 additions and 1 deletions

View file

@ -114,3 +114,11 @@ pub mod fmodf;
pub mod frexp;
#[path = "math/frexpf.rs"]
pub mod frexpf;
#[path = "math/hypot.rs"]
pub mod hypot;
#[path = "math/hypotf.rs"]
pub mod hypotf;
#[path = "math/ilogb.rs"]
pub mod ilogb;
#[path = "math/ilogbf.rs"]
pub mod ilogbf;

14
src/math/hypot.rs Normal file
View file

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

14
src/math/hypotf.rs Normal file
View file

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

14
src/math/ilogb.rs Normal file
View file

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

14
src/math/ilogbf.rs Normal file
View file

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