};
#[cfg(not(test))]
-#[cfg_attr(bootstrap, lang = "f64_runtime")]
impl f64 {
/// Returns the largest integer less than or equal to `self`.
///
/// assert_eq!(g.floor(), 3.0);
/// assert_eq!(h.floor(), -4.0);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
/// assert_eq!(f.ceil(), 4.0);
/// assert_eq!(g.ceil(), 4.0);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
/// assert_eq!(f.round(), 3.0);
/// assert_eq!(g.round(), -3.0);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
/// assert_eq!(g.trunc(), 3.0);
/// assert_eq!(h.trunc(), -3.0);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
/// assert!(abs_difference_x < 1e-10);
/// assert!(abs_difference_y < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(f64::NAN.abs().is_nan());
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(f64::NAN.signum().is_nan());
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(f64::NAN.copysign(1.0).is_nan());
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "copysign", since = "1.35.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
/// assert_eq!(a.div_euclid(-b), -1.0); // 7.0 >= -4.0 * -1.0
/// assert_eq!((-a).div_euclid(-b), 2.0); // -7.0 >= -4.0 * 2.0
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[inline]
#[stable(feature = "euclidean_division", since = "1.38.0")]
/// // limitation due to round-off error
/// assert!((-f64::EPSILON).rem_euclid(3.0) != 0.0);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[inline]
#[stable(feature = "euclidean_division", since = "1.38.0")]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
/// assert!(negative.sqrt().is_nan());
/// assert!(negative_zero.sqrt() == negative_zero);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
/// assert!(abs_difference_x < 1e-10);
/// assert!(abs_difference_y < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
- #[rustc_deprecated(
+ #[deprecated(
since = "1.10.0",
- reason = "you probably meant `(self - other).abs()`: \
- this operation is `(self - other).max(0.0)` \
- except that `abs_sub` also propagates NaNs (also \
- known as `fdim` in C). If you truly need the positive \
- difference, consider using that expression or the C function \
- `fdim`, depending on how you wish to handle NaN (please consider \
- filing an issue describing your use-case too)."
+ note = "you probably meant `(self - other).abs()`: \
+ this operation is `(self - other).max(0.0)` \
+ except that `abs_sub` also propagates NaNs (also \
+ known as `fdim` in C). If you truly need the positive \
+ difference, consider using that expression or the C function \
+ `fdim`, depending on how you wish to handle NaN (please consider \
+ filing an issue describing your use-case too)."
)]
pub fn abs_sub(self, other: f64) -> f64 {
unsafe { cmath::fdim(self, other) }
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-14);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
/// assert!(abs_difference_1 < 1e-10);
/// assert!(abs_difference_2 < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
/// assert!(abs_difference_0 < 1e-10);
/// assert!(abs_difference_1 < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn sin_cos(self) -> (f64, f64) {
///
/// assert!(abs_difference < 1e-20);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-20);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
/// // Same result
/// assert!(abs_difference < 1.0e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1.0e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1.0e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1.0e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
///
/// assert!(abs_difference < 1.0e-10);
/// ```
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
#[must_use = "method returns a new number and does not mutate the original value"]
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
// Solaris/Illumos requires a wrapper around log, log2, and log10 functions
// because of their non-standard behavior (e.g., log(-n) returns -Inf instead
// of expected NaN).
- #[cfg_attr(not(bootstrap), rustc_allow_incoherent_impl)]
+ #[rustc_allow_incoherent_impl]
fn log_wrapper<F: Fn(f64) -> f64>(self, log_fn: F) -> f64 {
if !cfg!(any(target_os = "solaris", target_os = "illumos")) {
log_fn(self)