Skip to content

Commit

Permalink
Update the libm submodule
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
tgross35 committed Feb 24, 2025
1 parent 238b055 commit 0a3d5c0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libm
Submodule libm updated 136 files
15 changes: 15 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![cfg_attr(feature = "compiler-builtins", compiler_builtins)]
#![cfg_attr(all(target_family = "wasm"), feature(wasm_numeric_instr))]
#![feature(abi_unadjusted)]
#![feature(asm_experimental_arch)]
#![feature(cfg_target_has_atomic)]
Expand Down Expand Up @@ -58,6 +59,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")]
Expand Down
2 changes: 1 addition & 1 deletion src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0a3d5c0

Please sign in to comment.