From 4b21f09d8d1e2c5a9d231eb59c31bec21138f051 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sun, 23 Feb 2025 23:43:26 +0000 Subject: [PATCH] Update the `libm` submodule This requires privately reexporting `libm`'s `support` module at crate root, where it is expected for macros. Once `libm` is made always available, the reexport can be simplified. This delta adds a lot of routines to `f16` and `f128`: * ceil * floor * fma (f128 only) * fmax * fmin * fmod * ldexp * rint * round * scalbn * sqrt Additionally, the following new API was added for all four float types: * fmaximum * fmaximum_num * fminimum * fminimum_num * roundeven There are also some significant performance improvements for `sqrt` and `sqrtf`, as well as precision improvements for `cbrt` (both `f32` and `f64` versions of this function are now always correctly rounded). --- libm | 2 +- src/lib.rs | 14 ++++++++++++++ src/math.rs | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/libm b/libm index 8e82616f..9a60739f 160000 --- a/libm +++ b/libm @@ -1 +1 @@ -Subproject commit 8e82616f154b06cf4ee9cdb82a4f56474a403d04 +Subproject commit 9a60739f6407e54f9899c43233bec368c0e97de7 diff --git a/src/lib.rs b/src/lib.rs index ffcd3586..9123f4b4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -58,6 +58,20 @@ pub mod int; all(target_family = "wasm", not(target_os = "unknown")) )))] pub mod math; + +// `libm` expects its `support` module to be available in the crate root. This config can be +// cleaned up once `libm` is made always available. +#[cfg(not(any( + all( + target_arch = "x86", + not(target_feature = "sse2"), + not(target_os = "uefi"), + ), + unix, + all(target_family = "wasm", not(target_os = "unknown")) +)))] +use math::libm::support; + pub mod mem; #[cfg(target_arch = "arm")] diff --git a/src/math.rs b/src/math.rs index 21670f24..fef5358e 100644 --- a/src/math.rs +++ b/src/math.rs @@ -3,7 +3,7 @@ #[allow(unused_imports)] #[allow(clippy::all)] #[path = "../libm/src/math/mod.rs"] -mod libm; +pub(crate) mod libm; #[allow(unused_macros)] macro_rules! no_mangle {