diff options
| author | bors <bors@rust-lang.org> | 2017-06-16 17:52:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-06-16 17:52:11 +0000 |
| commit | fe7227f6c8704f0186091085a14fd1027920e4bb (patch) | |
| tree | 8c3cb396146179783cb6d001fa7f4f67c6958575 /src/libstd | |
| parent | b40be00a0cac84d23f51c5c5109c8f824ab19ab3 (diff) | |
| parent | ba6cf1d80ac6f5ff3c36c7f6111197d429369d86 (diff) | |
| download | rust-fe7227f6c8704f0186091085a14fd1027920e4bb.tar.gz rust-fe7227f6c8704f0186091085a14fd1027920e4bb.zip | |
Auto merge of #42430 - nagisa:core-float, r=alexcrichton
Re-implement float min/max in rust This also adds the relevant implementations into libcore. See #42423
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/f32.rs | 6 | ||||
| -rw-r--r-- | src/libstd/f64.rs | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index 4abad7e24f8..6134b0b882c 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -46,8 +46,6 @@ mod cmath { pub fn erfcf(n: c_float) -> c_float; pub fn expm1f(n: c_float) -> c_float; pub fn fdimf(a: c_float, b: c_float) -> c_float; - pub fn fmaxf(a: c_float, b: c_float) -> c_float; - pub fn fminf(a: c_float, b: c_float) -> c_float; pub fn fmodf(a: c_float, b: c_float) -> c_float; pub fn ilogbf(n: c_float) -> c_int; pub fn logbf(n: c_float) -> c_float; @@ -673,7 +671,7 @@ impl f32 { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn max(self, other: f32) -> f32 { - unsafe { cmath::fmaxf(self, other) } + num::Float::max(self, other) } /// Returns the minimum of the two numbers. @@ -689,7 +687,7 @@ impl f32 { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn min(self, other: f32) -> f32 { - unsafe { cmath::fminf(self, other) } + num::Float::min(self, other) } /// The positive difference of two numbers. diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index 813998b7502..e8d25cfbf94 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -51,8 +51,6 @@ mod cmath { pub fn erfc(n: c_double) -> c_double; pub fn expm1(n: c_double) -> c_double; pub fn fdim(a: c_double, b: c_double) -> c_double; - pub fn fmax(a: c_double, b: c_double) -> c_double; - pub fn fmin(a: c_double, b: c_double) -> c_double; pub fn fmod(a: c_double, b: c_double) -> c_double; pub fn frexp(n: c_double, value: &mut c_int) -> c_double; pub fn ilogb(n: c_double) -> c_int; @@ -587,7 +585,7 @@ impl f64 { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn max(self, other: f64) -> f64 { - unsafe { cmath::fmax(self, other) } + num::Float::max(self, other) } /// Returns the minimum of the two numbers. @@ -603,7 +601,7 @@ impl f64 { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn min(self, other: f64) -> f64 { - unsafe { cmath::fmin(self, other) } + num::Float::min(self, other) } /// The positive difference of two numbers. |
