assert_ne and tracking issue
This commit is contained in:
parent
56760abf3b
commit
bdab5cdc63
@ -1238,11 +1238,11 @@ impl f32 {
|
|||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(float_bits_conv)]
|
/// #![feature(float_bits_conv)]
|
||||||
/// assert!((1f32).to_bits() != 1f32 as u32); // to_bits() is not casting!
|
/// assert_ne!((1f32).to_bits(), 1f32 as u32); // to_bits() is not casting!
|
||||||
/// assert_eq!((12.5f32).to_bits(), 0x41480000);
|
/// assert_eq!((12.5f32).to_bits(), 0x41480000);
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "float_bits_conv", reason = "recently added", issue = "0")]
|
#[unstable(feature = "float_bits_conv", reason = "recently added", issue = "40470")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_bits(self) -> u32 {
|
pub fn to_bits(self) -> u32 {
|
||||||
unsafe { ::mem::transmute(self) }
|
unsafe { ::mem::transmute(self) }
|
||||||
@ -1270,7 +1270,7 @@ impl f32 {
|
|||||||
/// // Example for a signaling NaN value:
|
/// // Example for a signaling NaN value:
|
||||||
/// assert_eq!(f32::from_bits(0x7F800001), Err(()));
|
/// assert_eq!(f32::from_bits(0x7F800001), Err(()));
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "float_bits_conv", reason = "recently added", issue = "0")]
|
#[unstable(feature = "float_bits_conv", reason = "recently added", issue = "40470")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn from_bits(v: u32) -> Result<Self, ()> {
|
pub fn from_bits(v: u32) -> Result<Self, ()> {
|
||||||
match v {
|
match v {
|
||||||
|
@ -1134,7 +1134,7 @@ impl f64 {
|
|||||||
/// assert_eq!((12.5f64).to_bits(), 0x4029000000000000);
|
/// assert_eq!((12.5f64).to_bits(), 0x4029000000000000);
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "float_bits_conv", reason = "recently added", issue = "0")]
|
#[unstable(feature = "float_bits_conv", reason = "recently added", issue = "40470")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_bits(self) -> u64 {
|
pub fn to_bits(self) -> u64 {
|
||||||
unsafe { ::mem::transmute(self) }
|
unsafe { ::mem::transmute(self) }
|
||||||
@ -1162,7 +1162,7 @@ impl f64 {
|
|||||||
/// // Example for a signaling NaN value:
|
/// // Example for a signaling NaN value:
|
||||||
/// assert_eq!(f64::from_bits(0x7FF0000000000001), Err(()));
|
/// assert_eq!(f64::from_bits(0x7FF0000000000001), Err(()));
|
||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "float_bits_conv", reason = "recently added", issue = "0")]
|
#[unstable(feature = "float_bits_conv", reason = "recently added", issue = "40470")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn from_bits(v: u64) -> Result<Self, ()> {
|
pub fn from_bits(v: u64) -> Result<Self, ()> {
|
||||||
match v {
|
match v {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user