@@ -221,8 +221,22 @@ impl f128 {
221221 pub const MAX_10_EXP : i32 = 4_932 ;
222222
223223 /// Returns `true` if this value is NaN.
224+ ///
225+ /// ```
226+ /// #![feature(f128)]
227+ /// # // FIXME(f16_f128): remove when `unordtf2` is available
228+ /// # #[cfg(target_arch = "x86_64", target_os = "linux")] {
229+ ///
230+ /// let nan = f128::NAN;
231+ /// let f = 7.0_f128;
232+ ///
233+ /// assert!(nan.is_nan());
234+ /// assert!(!f.is_nan());
235+ /// # }
236+ /// ```
224237 #[ inline]
225238 #[ must_use]
239+ #[ cfg( not( bootstrap) ) ]
226240 #[ unstable( feature = "f128" , issue = "116909" ) ]
227241 #[ allow( clippy:: eq_op) ] // > if you intended to check if the operand is NaN, use `.is_nan()` instead :)
228242 pub const fn is_nan ( self ) -> bool {
@@ -234,7 +248,7 @@ impl f128 {
234248 /// meaning to the sign bit in case of a NaN, and as Rust doesn't guarantee that
235249 /// the bit pattern of NaNs are conserved over arithmetic operations, the result of
236250 /// `is_sign_positive` on a NaN might produce an unexpected result in some cases.
237- /// See [explanation of NaN as a special value](f32 ) for more info.
251+ /// See [explanation of NaN as a special value](f128 ) for more info.
238252 ///
239253 /// ```
240254 /// #![feature(f128)]
@@ -257,7 +271,7 @@ impl f128 {
257271 /// meaning to the sign bit in case of a NaN, and as Rust doesn't guarantee that
258272 /// the bit pattern of NaNs are conserved over arithmetic operations, the result of
259273 /// `is_sign_negative` on a NaN might produce an unexpected result in some cases.
260- /// See [explanation of NaN as a special value](f32 ) for more info.
274+ /// See [explanation of NaN as a special value](f128 ) for more info.
261275 ///
262276 /// ```
263277 /// #![feature(f128)]
@@ -287,6 +301,14 @@ impl f128 {
287301 ///
288302 /// Note that this function is distinct from `as` casting, which attempts to
289303 /// preserve the *numeric* value, and not the bitwise value.
304+ ///
305+ /// ```
306+ /// #![feature(f128)]
307+ ///
308+ /// # // FIXME(f16_f128): enable this once const casting works
309+ /// # // assert_ne!((1f128).to_bits(), 1f128 as u128); // to_bits() is not casting!
310+ /// assert_eq!((12.5f128).to_bits(), 0x40029000000000000000000000000000);
311+ /// ```
290312 #[ inline]
291313 #[ unstable( feature = "f128" , issue = "116909" ) ]
292314 #[ must_use = "this returns the result of the operation, without modifying the original" ]
@@ -326,6 +348,16 @@ impl f128 {
326348 ///
327349 /// Note that this function is distinct from `as` casting, which attempts to
328350 /// preserve the *numeric* value, and not the bitwise value.
351+ ///
352+ /// ```
353+ /// #![feature(f128)]
354+ /// # // FIXME(f16_f128): remove when `eqtf2` is available
355+ /// # #[cfg(all(target_arch = "x86_64", target_os = "linux"))] {
356+ ///
357+ /// let v = f128::from_bits(0x40029000000000000000000000000000);
358+ /// assert_eq!(v, 12.5);
359+ /// # }
360+ /// ```
329361 #[ inline]
330362 #[ must_use]
331363 #[ unstable( feature = "f128" , issue = "116909" ) ]
0 commit comments