@@ -221,8 +221,22 @@ impl f128 {
221
221
pub const MAX_10_EXP : i32 = 4_932 ;
222
222
223
223
/// 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
+ /// ```
224
237
#[ inline]
225
238
#[ must_use]
239
+ #[ cfg( not( bootstrap) ) ]
226
240
#[ unstable( feature = "f128" , issue = "116909" ) ]
227
241
#[ allow( clippy:: eq_op) ] // > if you intended to check if the operand is NaN, use `.is_nan()` instead :)
228
242
pub const fn is_nan ( self ) -> bool {
@@ -234,7 +248,7 @@ impl f128 {
234
248
/// meaning to the sign bit in case of a NaN, and as Rust doesn't guarantee that
235
249
/// the bit pattern of NaNs are conserved over arithmetic operations, the result of
236
250
/// `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.
238
252
///
239
253
/// ```
240
254
/// #![feature(f128)]
@@ -257,7 +271,7 @@ impl f128 {
257
271
/// meaning to the sign bit in case of a NaN, and as Rust doesn't guarantee that
258
272
/// the bit pattern of NaNs are conserved over arithmetic operations, the result of
259
273
/// `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.
261
275
///
262
276
/// ```
263
277
/// #![feature(f128)]
@@ -287,6 +301,14 @@ impl f128 {
287
301
///
288
302
/// Note that this function is distinct from `as` casting, which attempts to
289
303
/// 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
+ /// ```
290
312
#[ inline]
291
313
#[ unstable( feature = "f128" , issue = "116909" ) ]
292
314
#[ must_use = "this returns the result of the operation, without modifying the original" ]
@@ -326,6 +348,16 @@ impl f128 {
326
348
///
327
349
/// Note that this function is distinct from `as` casting, which attempts to
328
350
/// 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
+ /// ```
329
361
#[ inline]
330
362
#[ must_use]
331
363
#[ unstable( feature = "f128" , issue = "116909" ) ]
0 commit comments