File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -324,6 +324,15 @@ impl f16 {
324324 ///
325325 /// The precision of this function is non-deterministic. This means it varies by platform,
326326 /// 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+ /// ```
327336 #[ inline]
328337 #[ rustc_allow_incoherent_impl]
329338 #[ unstable( feature = "f16" , issue = "116909" ) ]
@@ -347,8 +356,10 @@ impl f16 {
347356 ///
348357 /// let x = 2.0_f16;
349358 /// let abs_difference = (x.powf(2.0) - (x * x)).abs();
350- ///
351359 /// 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)
352363 /// # }
353364 /// ```
354365 #[ inline]
You can’t perform that action at this time.
0 commit comments