diff --git a/library/core/src/num/f128.rs b/library/core/src/num/f128.rs index 8fe81a9f5289d..9362dc8765492 100644 --- a/library/core/src/num/f128.rs +++ b/library/core/src/num/f128.rs @@ -228,6 +228,16 @@ impl f128 { /// the bit pattern of NaNs are conserved over arithmetic operations, the result of /// `is_sign_positive` on a NaN might produce an unexpected result in some cases. /// See [explanation of NaN as a special value](f32) for more info. + /// + /// ``` + /// #![feature(f128)] + /// + /// let f = 7.0_f128; + /// let g = -7.0_f128; + /// + /// assert!(f.is_sign_positive()); + /// assert!(!g.is_sign_positive()); + /// ``` #[inline] #[must_use] #[unstable(feature = "f128", issue = "116909")] @@ -241,6 +251,16 @@ impl f128 { /// the bit pattern of NaNs are conserved over arithmetic operations, the result of /// `is_sign_negative` on a NaN might produce an unexpected result in some cases. /// See [explanation of NaN as a special value](f32) for more info. + /// + /// ``` + /// #![feature(f128)] + /// + /// let f = 7.0_f128; + /// let g = -7.0_f128; + /// + /// assert!(!f.is_sign_negative()); + /// assert!(g.is_sign_negative()); + /// ``` #[inline] #[must_use] #[unstable(feature = "f128", issue = "116909")] diff --git a/library/core/src/num/f16.rs b/library/core/src/num/f16.rs index 4290245ab2983..c4d4584544bad 100644 --- a/library/core/src/num/f16.rs +++ b/library/core/src/num/f16.rs @@ -224,6 +224,16 @@ impl f16 { /// the bit pattern of NaNs are conserved over arithmetic operations, the result of /// `is_sign_positive` on a NaN might produce an unexpected result in some cases. /// See [explanation of NaN as a special value](f32) for more info. + /// + /// ``` + /// #![feature(f16)] + /// + /// let f = 7.0_f16; + /// let g = -7.0_f16; + /// + /// assert!(f.is_sign_positive()); + /// assert!(!g.is_sign_positive()); + /// ``` #[inline] #[must_use] #[unstable(feature = "f16", issue = "116909")] @@ -237,6 +247,16 @@ impl f16 { /// the bit pattern of NaNs are conserved over arithmetic operations, the result of /// `is_sign_negative` on a NaN might produce an unexpected result in some cases. /// See [explanation of NaN as a special value](f32) for more info. + /// + /// ``` + /// #![feature(f16)] + /// + /// let f = 7.0_f16; + /// let g = -7.0_f16; + /// + /// assert!(!f.is_sign_negative()); + /// assert!(g.is_sign_negative()); + /// ``` #[inline] #[must_use] #[unstable(feature = "f16", issue = "116909")] diff --git a/library/core/src/num/f64.rs b/library/core/src/num/f64.rs index d56f346d95e47..db8e1f318adba 100644 --- a/library/core/src/num/f64.rs +++ b/library/core/src/num/f64.rs @@ -1111,7 +1111,6 @@ impl f64 { /// ``` /// assert!((1f64).to_bits() != 1f64 as u64); // to_bits() is not casting! /// assert_eq!((12.5f64).to_bits(), 0x4029000000000000); - /// /// ``` #[must_use = "this returns the result of the operation, \ without modifying the original"]