Run cargo fmt --all
This commit is contained in:
parent
4b1ea5fb12
commit
0547a355ee
|
@ -10,7 +10,6 @@ use {Num, NumCast, ToPrimitive};
|
|||
#[cfg(feature = "libm")]
|
||||
use libm::{F32Ext, F64Ext};
|
||||
|
||||
|
||||
/// Generic trait for floating point numbers that works with `no_std`.
|
||||
///
|
||||
/// This trait implements a subset of the `Float` trait.
|
||||
|
@ -1835,7 +1834,7 @@ macro_rules! float_impl_std {
|
|||
$decode(self)
|
||||
}
|
||||
|
||||
forward!{
|
||||
forward! {
|
||||
Self::is_nan(self) -> bool;
|
||||
Self::is_infinite(self) -> bool;
|
||||
Self::is_finite(self) -> bool;
|
||||
|
@ -1914,7 +1913,7 @@ macro_rules! float_impl_libm {
|
|||
$decode(self)
|
||||
}
|
||||
|
||||
forward!{
|
||||
forward! {
|
||||
FloatCore::is_nan(self) -> bool;
|
||||
FloatCore::is_infinite(self) -> bool;
|
||||
FloatCore::is_finite(self) -> bool;
|
||||
|
@ -2009,7 +2008,6 @@ float_impl_libm!(f32 integer_decode_f32 F32Ext);
|
|||
#[cfg(all(not(feature = "std"), feature = "libm"))]
|
||||
float_impl_libm!(f64 integer_decode_f64 F64Ext);
|
||||
|
||||
|
||||
macro_rules! float_const_impl {
|
||||
($(#[$doc:meta] $constant:ident,)+) => (
|
||||
#[allow(non_snake_case)]
|
||||
|
|
10
src/pow.rs
10
src/pow.rs
|
@ -155,15 +155,15 @@ pow_impl!(Wrapping<isize>);
|
|||
#[cfg(any(feature = "std", feature = "libm"))]
|
||||
mod float_impls {
|
||||
use super::Pow;
|
||||
use ::Float;
|
||||
use Float;
|
||||
|
||||
pow_impl!(f32, i8, i32, <f32 as Float>::powi);
|
||||
pow_impl!(f32, u8, i32, <f32 as Float>::powi);
|
||||
pow_impl!(f32, i8, i32, <f32 as Float>::powi);
|
||||
pow_impl!(f32, u8, i32, <f32 as Float>::powi);
|
||||
pow_impl!(f32, i16, i32, <f32 as Float>::powi);
|
||||
pow_impl!(f32, u16, i32, <f32 as Float>::powi);
|
||||
pow_impl!(f32, i32, i32, <f32 as Float>::powi);
|
||||
pow_impl!(f64, i8, i32, <f64 as Float>::powi);
|
||||
pow_impl!(f64, u8, i32, <f64 as Float>::powi);
|
||||
pow_impl!(f64, i8, i32, <f64 as Float>::powi);
|
||||
pow_impl!(f64, u8, i32, <f64 as Float>::powi);
|
||||
pow_impl!(f64, i16, i32, <f64 as Float>::powi);
|
||||
pow_impl!(f64, u16, i32, <f64 as Float>::powi);
|
||||
pow_impl!(f64, i32, i32, <f64 as Float>::powi);
|
||||
|
|
188
src/real.rs
188
src/real.rs
|
@ -20,8 +20,8 @@ use Float;
|
|||
pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
||||
/// Returns the smallest finite value that this type can represent.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -33,8 +33,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Returns the smallest positive, normalized value that this type can represent.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -46,8 +46,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Returns epsilon, a small positive value.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -64,8 +64,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Returns the largest finite value that this type can represent.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -76,8 +76,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Returns the largest integer less than or equal to a number.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let f = 3.99;
|
||||
|
@ -90,8 +90,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Returns the smallest integer greater than or equal to a number.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let f = 3.01;
|
||||
|
@ -105,8 +105,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// Returns the nearest integer to a number. Round half-way cases away from
|
||||
/// `0.0`.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let f = 3.3;
|
||||
|
@ -119,8 +119,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Return the integer part of a number.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let f = 3.3;
|
||||
|
@ -133,8 +133,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Returns the fractional part of a number.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let x = 3.5;
|
||||
|
@ -150,8 +150,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// Computes the absolute value of `self`. Returns `Float::nan()` if the
|
||||
/// number is `Float::nan()`.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -174,8 +174,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// - `-1.0` if the number is negative, `-0.0` or `Float::neg_infinity()`
|
||||
/// - `Float::nan()` if the number is `Float::nan()`
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -191,8 +191,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// Returns `true` if `self` is positive, including `+0.0`,
|
||||
/// `Float::infinity()`, and with newer versions of Rust `f64::NAN`.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -210,8 +210,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// Returns `true` if `self` is negative, including `-0.0`,
|
||||
/// `Float::neg_infinity()`, and with newer versions of Rust `-f64::NAN`.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -232,8 +232,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// Using `mul_add` can be more performant than an unfused multiply-add if
|
||||
/// the target architecture has a dedicated `fma` CPU instruction.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let m = 10.0;
|
||||
|
@ -249,8 +249,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Take the reciprocal (inverse) of a number, `1/x`.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let x = 2.0;
|
||||
|
@ -264,8 +264,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
///
|
||||
/// Using this function is generally faster than using `powf`
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let x = 2.0;
|
||||
|
@ -277,8 +277,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Raise a number to a real number power.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let x = 2.0;
|
||||
|
@ -296,8 +296,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
///
|
||||
/// If the implementing type doesn't support NaN, this method should panic if `self < 0`.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let positive = 4.0;
|
||||
|
@ -312,8 +312,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Returns `e^(self)`, (the exponential function).
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let one = 1.0;
|
||||
|
@ -329,8 +329,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Returns `2^(self)`.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let f = 2.0;
|
||||
|
@ -348,8 +348,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
///
|
||||
/// If `self <= 0` and this type does not support a NaN representation, this function should panic.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let one = 1.0;
|
||||
|
@ -369,8 +369,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
///
|
||||
/// If `self <= 0` and this type does not support a NaN representation, this function should panic.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let ten = 10.0;
|
||||
|
@ -393,8 +393,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
///
|
||||
/// If `self <= 0` and this type does not support a NaN representation, this function should panic.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let two = 2.0;
|
||||
|
@ -413,8 +413,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// If `self <= 0` and this type does not support a NaN representation, this function should panic.
|
||||
///
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let ten = 10.0;
|
||||
|
@ -428,8 +428,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Converts radians to degrees.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use std::f64::consts;
|
||||
///
|
||||
/// let angle = consts::PI;
|
||||
|
@ -442,8 +442,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Converts degrees to radians.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use std::f64::consts;
|
||||
///
|
||||
/// let angle = 180.0_f64;
|
||||
|
@ -456,8 +456,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Returns the maximum of the two numbers.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let x = 1.0;
|
||||
|
@ -469,8 +469,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Returns the minimum of the two numbers.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let x = 1.0;
|
||||
|
@ -485,8 +485,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// * If `self <= other`: `0:0`
|
||||
/// * Else: `self - other`
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let x = 3.0;
|
||||
|
@ -502,8 +502,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Take the cubic root of a number.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let x = 8.0;
|
||||
|
@ -518,8 +518,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// Calculate the length of the hypotenuse of a right-angle triangle given
|
||||
/// legs of length `x` and `y`.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let x = 2.0;
|
||||
|
@ -534,8 +534,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Computes the sine of a number (in radians).
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -549,8 +549,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Computes the cosine of a number (in radians).
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -564,8 +564,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Computes the tangent of a number (in radians).
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -585,8 +585,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// If this type does not support a NaN representation, this function should panic
|
||||
/// if the number is outside the range [-1, 1].
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -608,8 +608,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// If this type does not support a NaN representation, this function should panic
|
||||
/// if the number is outside the range [-1, 1].
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -625,8 +625,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// Computes the arctangent of a number. Return value is in radians in the
|
||||
/// range [-pi/2, pi/2];
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let f = 1.0;
|
||||
|
@ -645,8 +645,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// * `y >= 0`: `arctan(y/x) + pi` -> `(pi/2, pi]`
|
||||
/// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)`
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -671,8 +671,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// Simultaneously computes the sine and cosine of the number, `x`. Returns
|
||||
/// `(sin(x), cos(x))`.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -690,8 +690,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// Returns `e^(self) - 1` in a way that is accurate even if the
|
||||
/// number is close to zero.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let x = 7.0;
|
||||
|
@ -711,8 +711,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
/// If this type does not support a NaN representation, this function should panic
|
||||
/// if `self-1 <= 0`.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -727,8 +727,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Hyperbolic sine function.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -746,8 +746,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Hyperbolic cosine function.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -765,8 +765,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Hyperbolic tangent function.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
@ -784,8 +784,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Inverse hyperbolic sine function.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let x = 1.0;
|
||||
|
@ -799,8 +799,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Inverse hyperbolic cosine function.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
///
|
||||
/// let x = 1.0;
|
||||
|
@ -814,8 +814,8 @@ pub trait Real: Num + Copy + NumCast + PartialOrd + Neg<Output = Self> {
|
|||
|
||||
/// Inverse hyperbolic tangent function.
|
||||
///
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc=" ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc=" ```ignore")]
|
||||
#[cfg_attr(any(feature = "std", feature = "libm"), doc = " ```")]
|
||||
#[cfg_attr(not(any(feature = "std", feature = "libm")), doc = " ```ignore")]
|
||||
/// use num_traits::real::Real;
|
||||
/// use std::f64;
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue