File tree 3 files changed +0
-66
lines changed
3 files changed +0
-66
lines changed Original file line number Diff line number Diff line change @@ -481,32 +481,6 @@ pub trait Ord: Eq + PartialOrd<Self> {
481
481
where Self : Sized {
482
482
if self <= other { self } else { other }
483
483
}
484
-
485
- /// Returns max if self is greater than max, and min if self is less than min.
486
- /// Otherwise this will return self. Panics if min > max.
487
- ///
488
- /// # Examples
489
- ///
490
- /// ```
491
- /// #![feature(clamp)]
492
- ///
493
- /// assert!((-3).clamp(-2, 1) == -2);
494
- /// assert!(0.clamp(-2, 1) == 0);
495
- /// assert!(2.clamp(-2, 1) == 1);
496
- /// ```
497
- #[ unstable( feature = "clamp" , issue = "44095" ) ]
498
- fn clamp ( self , min : Self , max : Self ) -> Self
499
- where Self : Sized {
500
- assert ! ( min <= max) ;
501
- if self < min {
502
- min
503
- }
504
- else if self > max {
505
- max
506
- } else {
507
- self
508
- }
509
- }
510
484
}
511
485
512
486
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
Original file line number Diff line number Diff line change @@ -1080,26 +1080,6 @@ impl f32 {
1080
1080
0.5 * ( ( 2.0 * self ) / ( 1.0 - self ) ) . ln_1p ( )
1081
1081
}
1082
1082
1083
- /// Returns max if self is greater than max, and min if self is less than min.
1084
- /// Otherwise this returns self. Panics if min > max, min equals NaN, or max equals NaN.
1085
- ///
1086
- /// # Examples
1087
- ///
1088
- /// ```
1089
- /// assert!((-3.0f32).clamp(-2.0f32, 1.0f32) == -2.0f32);
1090
- /// assert!((0.0f32).clamp(-2.0f32, 1.0f32) == 0.0f32);
1091
- /// assert!((2.0f32).clamp(-2.0f32, 1.0f32) == 1.0f32);
1092
- /// ```
1093
- #[ unstable( feature = "clamp" , issue = "44095" ) ]
1094
- #[ inline]
1095
- pub fn clamp ( self , min : f32 , max : f32 ) -> f32 {
1096
- assert ! ( min <= max) ;
1097
- let mut x = self ;
1098
- if x < min { x = min; }
1099
- if x > max { x = max; }
1100
- x
1101
- }
1102
-
1103
1083
/// Raw transmutation to `u32`.
1104
1084
///
1105
1085
/// Converts the `f32` into its raw memory representation,
Original file line number Diff line number Diff line change @@ -970,26 +970,6 @@ impl f64 {
970
970
0.5 * ( ( 2.0 * self ) / ( 1.0 - self ) ) . ln_1p ( )
971
971
}
972
972
973
- /// Returns max if self is greater than max, and min if self is less than min.
974
- /// Otherwise this returns self. Panics if min > max, min equals NaN, or max equals NaN.
975
- ///
976
- /// # Examples
977
- ///
978
- /// ```
979
- /// assert!((-3.0f64).clamp(-2.0f64, 1.0f64) == -2.0f64);
980
- /// assert!((0.0f64).clamp(-2.0f64, 1.0f64) == 0.0f64);
981
- /// assert!((2.0f64).clamp(-2.0f64, 1.0f64) == 1.0f64);
982
- /// ```
983
- #[ unstable( feature = "clamp" , issue = "44095" ) ]
984
- #[ inline]
985
- pub fn clamp ( self , min : f64 , max : f64 ) -> f64 {
986
- assert ! ( min <= max) ;
987
- let mut x = self ;
988
- if x < min { x = min; }
989
- if x > max { x = max; }
990
- x
991
- }
992
-
993
973
// Solaris/Illumos requires a wrapper around log, log2, and log10 functions
994
974
// because of their non-standard behavior (e.g. log(-n) returns -Inf instead
995
975
// of expected NaN).
You can’t perform that action at this time.
0 commit comments