File tree 1 file changed +12
-1
lines changed 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -324,6 +324,15 @@ impl f16 {
324
324
///
325
325
/// The precision of this function is non-deterministic. This means it varies by platform,
326
326
/// Rust version, and can even differ within the same execution from one invocation to the next.
327
+ /// # Examples
328
+ ///
329
+ /// ```
330
+ /// let x = 2.0_f16;
331
+ /// let abs_difference = (x.powi(2) - (x * x)).abs();
332
+ /// assert!(abs_difference < f16::EPSILON);
333
+ ///
334
+ /// assert_eq!(f16::powi(f16::NAN, 0), 1.0);
335
+ /// ```
327
336
#[ inline]
328
337
#[ rustc_allow_incoherent_impl]
329
338
#[ unstable( feature = "f16" , issue = "116909" ) ]
@@ -347,8 +356,10 @@ impl f16 {
347
356
///
348
357
/// let x = 2.0_f16;
349
358
/// let abs_difference = (x.powf(2.0) - (x * x)).abs();
350
- ///
351
359
/// assert!(abs_difference <= f16::EPSILON);
360
+ ///
361
+ /// assert_eq!(f16::powf(1.0, f16::NAN), 1.0)
362
+ /// assert_eq!(f16::powf(f16::NAN, 0.0), 1.0)
352
363
/// # }
353
364
/// ```
354
365
#[ inline]
You can’t perform that action at this time.
0 commit comments