File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -324,6 +324,16 @@ impl f128 {
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
+ ///
328
+ /// # Examples
329
+ ///
330
+ /// ```
331
+ /// let x = 2.0_f128;
332
+ /// let abs_difference = (x.powi(2) - (x * x)).abs();
333
+ /// assert!(abs_difference < f128::EPSILON);
334
+ ///
335
+ /// assert_eq!(f128::powi(f128::NAN, 0), 1.0);
336
+ /// ```
327
337
#[ inline]
328
338
#[ rustc_allow_incoherent_impl]
329
339
#[ unstable( feature = "f128" , issue = "116909" ) ]
@@ -347,8 +357,10 @@ impl f128 {
347
357
///
348
358
/// let x = 2.0_f128;
349
359
/// let abs_difference = (x.powf(2.0) - (x * x)).abs();
350
- ///
351
360
/// assert!(abs_difference <= f128::EPSILON);
361
+ ///
362
+ /// assert_eq!(f128::powf(1.0, f128::NAN), 1.0)
363
+ /// assert_eq!(f128::powf(f128::NAN, 0.0), 1.0)
352
364
/// # }
353
365
/// ```
354
366
#[ inline]
You can’t perform that action at this time.
0 commit comments