@@ -221,8 +221,21 @@ 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
+ /// # #[cfg(target_arch = "x86_64")] { // FIXME(f16_f128): remove when `unordtf2` is available
228
+ ///
229
+ /// let nan = f128::NAN;
230
+ /// let f = 7.0_f128;
231
+ ///
232
+ /// assert!(nan.is_nan());
233
+ /// assert!(!f.is_nan());
234
+ /// # }
235
+ /// ```
224
236
#[ inline]
225
237
#[ must_use]
238
+ #[ cfg( not( bootstrap) ) ]
226
239
#[ unstable( feature = "f128" , issue = "116909" ) ]
227
240
#[ allow( clippy:: eq_op) ] // > if you intended to check if the operand is NaN, use `.is_nan()` instead :)
228
241
pub const fn is_nan ( self ) -> bool {
@@ -234,7 +247,7 @@ impl f128 {
234
247
/// meaning to the sign bit in case of a NaN, and as Rust doesn't guarantee that
235
248
/// the bit pattern of NaNs are conserved over arithmetic operations, the result of
236
249
/// `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.
250
+ /// See [explanation of NaN as a special value](f128 ) for more info.
238
251
///
239
252
/// ```
240
253
/// #![feature(f128)]
@@ -257,7 +270,7 @@ impl f128 {
257
270
/// meaning to the sign bit in case of a NaN, and as Rust doesn't guarantee that
258
271
/// the bit pattern of NaNs are conserved over arithmetic operations, the result of
259
272
/// `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.
273
+ /// See [explanation of NaN as a special value](f128 ) for more info.
261
274
///
262
275
/// ```
263
276
/// #![feature(f128)]
@@ -287,6 +300,14 @@ impl f128 {
287
300
///
288
301
/// Note that this function is distinct from `as` casting, which attempts to
289
302
/// preserve the *numeric* value, and not the bitwise value.
303
+ ///
304
+ /// ```
305
+ /// #![feature(f128)]
306
+ ///
307
+ /// # // FIXME(f16_f128): enable this once const casting works
308
+ /// # // assert_ne!((1f128).to_bits(), 1f128 as u128); // to_bits() is not casting!
309
+ /// assert_eq!((12.5f128).to_bits(), 0x40029000000000000000000000000000);
310
+ /// ```
290
311
#[ inline]
291
312
#[ unstable( feature = "f128" , issue = "116909" ) ]
292
313
#[ must_use = "this returns the result of the operation, without modifying the original" ]
@@ -326,6 +347,15 @@ impl f128 {
326
347
///
327
348
/// Note that this function is distinct from `as` casting, which attempts to
328
349
/// preserve the *numeric* value, and not the bitwise value.
350
+ ///
351
+ /// ```
352
+ /// #![feature(f128)]
353
+ /// # #[cfg(target_arch = "x86_64")] { // FIXME(f16_f128): remove when `eqtf2` is available
354
+ ///
355
+ /// let v = f128::from_bits(0x40029000000000000000000000000000);
356
+ /// assert_eq!(v, 12.5);
357
+ /// # }
358
+ /// ```
329
359
#[ inline]
330
360
#[ must_use]
331
361
#[ unstable( feature = "f128" , issue = "116909" ) ]
0 commit comments