Add doctests for f16 and f128 library functions where possible
This commit is contained in:
parent
2d89cee625
commit
a7ca099e03
3 changed files with 40 additions and 1 deletions
|
@ -228,6 +228,16 @@ impl f128 {
|
|||
/// the bit pattern of NaNs are conserved over arithmetic operations, the result of
|
||||
/// `is_sign_positive` on a NaN might produce an unexpected result in some cases.
|
||||
/// See [explanation of NaN as a special value](f32) for more info.
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(f128)]
|
||||
///
|
||||
/// let f = 7.0_f128;
|
||||
/// let g = -7.0_f128;
|
||||
///
|
||||
/// assert!(f.is_sign_positive());
|
||||
/// assert!(!g.is_sign_positive());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[unstable(feature = "f128", issue = "116909")]
|
||||
|
@ -241,6 +251,16 @@ impl f128 {
|
|||
/// the bit pattern of NaNs are conserved over arithmetic operations, the result of
|
||||
/// `is_sign_negative` on a NaN might produce an unexpected result in some cases.
|
||||
/// See [explanation of NaN as a special value](f32) for more info.
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(f128)]
|
||||
///
|
||||
/// let f = 7.0_f128;
|
||||
/// let g = -7.0_f128;
|
||||
///
|
||||
/// assert!(!f.is_sign_negative());
|
||||
/// assert!(g.is_sign_negative());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[unstable(feature = "f128", issue = "116909")]
|
||||
|
|
|
@ -224,6 +224,16 @@ impl f16 {
|
|||
/// the bit pattern of NaNs are conserved over arithmetic operations, the result of
|
||||
/// `is_sign_positive` on a NaN might produce an unexpected result in some cases.
|
||||
/// See [explanation of NaN as a special value](f32) for more info.
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(f16)]
|
||||
///
|
||||
/// let f = 7.0_f16;
|
||||
/// let g = -7.0_f16;
|
||||
///
|
||||
/// assert!(f.is_sign_positive());
|
||||
/// assert!(!g.is_sign_positive());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[unstable(feature = "f16", issue = "116909")]
|
||||
|
@ -237,6 +247,16 @@ impl f16 {
|
|||
/// the bit pattern of NaNs are conserved over arithmetic operations, the result of
|
||||
/// `is_sign_negative` on a NaN might produce an unexpected result in some cases.
|
||||
/// See [explanation of NaN as a special value](f32) for more info.
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(f16)]
|
||||
///
|
||||
/// let f = 7.0_f16;
|
||||
/// let g = -7.0_f16;
|
||||
///
|
||||
/// assert!(!f.is_sign_negative());
|
||||
/// assert!(g.is_sign_negative());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[unstable(feature = "f16", issue = "116909")]
|
||||
|
|
|
@ -1111,7 +1111,6 @@ impl f64 {
|
|||
/// ```
|
||||
/// assert!((1f64).to_bits() != 1f64 as u64); // to_bits() is not casting!
|
||||
/// assert_eq!((12.5f64).to_bits(), 0x4029000000000000);
|
||||
///
|
||||
/// ```
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue