about summary refs log tree commit diff
path: root/library/std/src/sys/cmath.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-05-17 19:31:39 +0000
committerbors <bors@rust-lang.org>2025-05-17 19:31:39 +0000
commit777d372772aa3b39ba7273fcb8208a89f2ab0afd (patch)
treeedc690dfeab69a2a29055c79320316c2beb56e57 /library/std/src/sys/cmath.rs
parentbf5a38d118a46fb5fdff90e3dc3cbb58fe618c46 (diff)
parent65117eeda8dd672fe1420538d8cf228ee41e13f7 (diff)
downloadrust-777d372772aa3b39ba7273fcb8208a89f2ab0afd.tar.gz
rust-777d372772aa3b39ba7273fcb8208a89f2ab0afd.zip
Auto merge of #138087 - tgross35:core-float-math, r=Amanieu
Initial implementation of `core_float_math`

Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1], with the exception of `powi` that has been there longer.

Details for each of the changes is in the commit messages.

Tracking issue: https://github.com/rust-lang/rust/issues/137578

[1]: https://github.com/rust-lang/compiler-builtins/pull/763

try-job: aarch64-gnu
tru-job: armhf-gnu
try-job: i686-msvc-1
try-job: test-various
try-job: x86_64-mingw-1
try-job: x86_64-mingw-2
Diffstat (limited to 'library/std/src/sys/cmath.rs')
-rw-r--r--library/std/src/sys/cmath.rs4
1 files changed, 0 insertions, 4 deletions
diff --git a/library/std/src/sys/cmath.rs b/library/std/src/sys/cmath.rs
index 668fd928534..299ce1a6ff0 100644
--- a/library/std/src/sys/cmath.rs
+++ b/library/std/src/sys/cmath.rs
@@ -7,13 +7,9 @@ unsafe extern "C" {
     pub safe fn asin(n: f64) -> f64;
     pub safe fn atan(n: f64) -> f64;
     pub safe fn atan2(a: f64, b: f64) -> f64;
-    pub safe fn cbrt(n: f64) -> f64;
-    pub safe fn cbrtf(n: f32) -> f32;
     pub safe fn cosh(n: f64) -> f64;
     pub safe fn expm1(n: f64) -> f64;
     pub safe fn expm1f(n: f32) -> f32;
-    pub safe fn fdim(a: f64, b: f64) -> f64;
-    pub safe fn fdimf(a: f32, b: f32) -> f32;
     #[cfg_attr(target_env = "msvc", link_name = "_hypot")]
     pub safe fn hypot(x: f64, y: f64) -> f64;
     #[cfg_attr(target_env = "msvc", link_name = "_hypotf")]