@@ -216,8 +216,21 @@ impl f16 {
216216 pub const MAX_10_EXP : i32 = 4 ;
217217
218218 /// Returns `true` if this value is NaN.
219+ ///
220+ /// ```
221+ /// #![feature(f16)]
222+ /// # #[cfg(target_arch = "x86_64")] { // FIXME(f16_f128): remove when ABI bugs are fixed
223+ ///
224+ /// let nan = f16::NAN;
225+ /// let f = 7.0_f16;
226+ ///
227+ /// assert!(nan.is_nan());
228+ /// assert!(!f.is_nan());
229+ /// # }
230+ /// ```
219231 #[ inline]
220232 #[ must_use]
233+ #[ cfg( not( bootstrap) ) ]
221234 #[ unstable( feature = "f16" , issue = "116909" ) ]
222235 #[ allow( clippy:: eq_op) ] // > if you intended to check if the operand is NaN, use `.is_nan()` instead :)
223236 pub const fn is_nan ( self ) -> bool {
@@ -229,7 +242,7 @@ impl f16 {
229242 /// meaning to the sign bit in case of a NaN, and as Rust doesn't guarantee that
230243 /// the bit pattern of NaNs are conserved over arithmetic operations, the result of
231244 /// `is_sign_positive` on a NaN might produce an unexpected result in some cases.
232- /// See [explanation of NaN as a special value](f32 ) for more info.
245+ /// See [explanation of NaN as a special value](f16 ) for more info.
233246 ///
234247 /// ```
235248 /// #![feature(f16)]
@@ -252,7 +265,7 @@ impl f16 {
252265 /// meaning to the sign bit in case of a NaN, and as Rust doesn't guarantee that
253266 /// the bit pattern of NaNs are conserved over arithmetic operations, the result of
254267 /// `is_sign_negative` on a NaN might produce an unexpected result in some cases.
255- /// See [explanation of NaN as a special value](f32 ) for more info.
268+ /// See [explanation of NaN as a special value](f16 ) for more info.
256269 ///
257270 /// ```
258271 /// #![feature(f16)]
@@ -282,6 +295,16 @@ impl f16 {
282295 ///
283296 /// Note that this function is distinct from `as` casting, which attempts to
284297 /// preserve the *numeric* value, and not the bitwise value.
298+ ///
299+ /// ```
300+ /// #![feature(f16)]
301+ /// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
302+ ///
303+ /// # // FIXME(f16_f128): enable this once const casting works
304+ /// # // assert_ne!((1f16).to_bits(), 1f16 as u128); // to_bits() is not casting!
305+ /// assert_eq!((12.5f16).to_bits(), 0x4a40);
306+ /// # }
307+ /// ```
285308 #[ inline]
286309 #[ unstable( feature = "f16" , issue = "116909" ) ]
287310 #[ must_use = "this returns the result of the operation, without modifying the original" ]
@@ -321,6 +344,15 @@ impl f16 {
321344 ///
322345 /// Note that this function is distinct from `as` casting, which attempts to
323346 /// preserve the *numeric* value, and not the bitwise value.
347+ ///
348+ /// ```
349+ /// #![feature(f16)]
350+ /// # #[cfg(target_arch = "aarch64")] { // FIXME(f16_F128): rust-lang/rust#123885
351+ ///
352+ /// let v = f16::from_bits(0x4a40);
353+ /// assert_eq!(v, 12.5);
354+ /// # }
355+ /// ```
324356 #[ inline]
325357 #[ must_use]
326358 #[ unstable( feature = "f16" , issue = "116909" ) ]
0 commit comments