summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorSimonas Kazlauskas <git@kazlauskas.me>2017-06-04 21:39:00 +0300
committerSimonas Kazlauskas <git@kazlauskas.me>2017-06-14 21:58:17 +0300
commitba6cf1d80ac6f5ff3c36c7f6111197d429369d86 (patch)
treea3b4c369f30cbd89510a69b7bf5b3fc7239cafba /src/libstd
parent0da9721ab49d80bf74208e94a891b12c4a248507 (diff)
downloadrust-ba6cf1d80ac6f5ff3c36c7f6111197d429369d86.tar.gz
rust-ba6cf1d80ac6f5ff3c36c7f6111197d429369d86.zip
Re-implement float min/max in rust
See #42423
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/f32.rs6
-rw-r--r--src/libstd/f64.rs6
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 82e3903eec7..e9b5e4c8869 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.