@@ -553,79 +553,6 @@ pub trait Float: Signed + Round + Primitive {
553553 fn to_radians ( & self ) -> Self ;
554554}
555555
556- /// Returns the exponential of the number, minus `1`, `exp(n) - 1`, in a way
557- /// that is accurate even if the number is close to zero.
558- #[ inline( always) ] pub fn exp_m1 < T : Float > ( value : T ) -> T { value. exp_m1 ( ) }
559- /// Returns the natural logarithm of the number plus `1`, `ln(n + 1)`, more
560- /// accurately than if the operations were performed separately.
561- #[ inline( always) ] pub fn ln_1p < T : Float > ( value : T ) -> T { value. ln_1p ( ) }
562- /// Fused multiply-add. Computes `(a * b) + c` with only one rounding error.
563- ///
564- /// This produces a more accurate result with better performance (on some
565- /// architectures) than a separate multiplication operation followed by an add.
566- #[ inline( always) ] pub fn mul_add < T : Float > ( a : T , b : T , c : T ) -> T { a. mul_add ( b, c) }
567-
568- /// Raise a number to a power.
569- ///
570- /// # Example
571- ///
572- /// ```rust
573- /// use std::num;
574- ///
575- /// let sixteen: f64 = num::powf(2.0, 4.0);
576- /// assert_eq!(sixteen, 16.0);
577- /// ```
578- #[ inline( always) ] pub fn powf < T : Float > ( value : T , n : T ) -> T { value. powf ( & n) }
579- /// Take the square root of a number.
580- #[ inline( always) ] pub fn sqrt < T : Float > ( value : T ) -> T { value. sqrt ( ) }
581- /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
582- #[ inline( always) ] pub fn rsqrt < T : Float > ( value : T ) -> T { value. rsqrt ( ) }
583- /// Take the cubic root of a number.
584- #[ inline( always) ] pub fn cbrt < T : Float > ( value : T ) -> T { value. cbrt ( ) }
585- /// Calculate the length of the hypotenuse of a right-angle triangle given legs
586- /// of length `x` and `y`.
587- #[ inline( always) ] pub fn hypot < T : Float > ( x : T , y : T ) -> T { x. hypot ( & y) }
588- /// Sine function.
589- #[ inline( always) ] pub fn sin < T : Float > ( value : T ) -> T { value. sin ( ) }
590- /// Cosine function.
591- #[ inline( always) ] pub fn cos < T : Float > ( value : T ) -> T { value. cos ( ) }
592- /// Tangent function.
593- #[ inline( always) ] pub fn tan < T : Float > ( value : T ) -> T { value. tan ( ) }
594- /// Compute the arcsine of the number.
595- #[ inline( always) ] pub fn asin < T : Float > ( value : T ) -> T { value. asin ( ) }
596- /// Compute the arccosine of the number.
597- #[ inline( always) ] pub fn acos < T : Float > ( value : T ) -> T { value. acos ( ) }
598- /// Compute the arctangent of the number.
599- #[ inline( always) ] pub fn atan < T : Float > ( value : T ) -> T { value. atan ( ) }
600- /// Compute the arctangent with 2 arguments.
601- #[ inline( always) ] pub fn atan2 < T : Float > ( x : T , y : T ) -> T { x. atan2 ( & y) }
602- /// Simultaneously computes the sine and cosine of the number.
603- #[ inline( always) ] pub fn sin_cos < T : Float > ( value : T ) -> ( T , T ) { value. sin_cos ( ) }
604- /// Returns `e^(value)`, (the exponential function).
605- #[ inline( always) ] pub fn exp < T : Float > ( value : T ) -> T { value. exp ( ) }
606- /// Returns 2 raised to the power of the number, `2^(value)`.
607- #[ inline( always) ] pub fn exp2 < T : Float > ( value : T ) -> T { value. exp2 ( ) }
608- /// Returns the natural logarithm of the number.
609- #[ inline( always) ] pub fn ln < T : Float > ( value : T ) -> T { value. ln ( ) }
610- /// Returns the logarithm of the number with respect to an arbitrary base.
611- #[ inline( always) ] pub fn log < T : Float > ( value : T , base : T ) -> T { value. log ( & base) }
612- /// Returns the base 2 logarithm of the number.
613- #[ inline( always) ] pub fn log2 < T : Float > ( value : T ) -> T { value. log2 ( ) }
614- /// Returns the base 10 logarithm of the number.
615- #[ inline( always) ] pub fn log10 < T : Float > ( value : T ) -> T { value. log10 ( ) }
616- /// Hyperbolic sine function.
617- #[ inline( always) ] pub fn sinh < T : Float > ( value : T ) -> T { value. sinh ( ) }
618- /// Hyperbolic cosine function.
619- #[ inline( always) ] pub fn cosh < T : Float > ( value : T ) -> T { value. cosh ( ) }
620- /// Hyperbolic tangent function.
621- #[ inline( always) ] pub fn tanh < T : Float > ( value : T ) -> T { value. tanh ( ) }
622- /// Inverse hyperbolic sine function.
623- #[ inline( always) ] pub fn asinh < T : Float > ( value : T ) -> T { value. asinh ( ) }
624- /// Inverse hyperbolic cosine function.
625- #[ inline( always) ] pub fn acosh < T : Float > ( value : T ) -> T { value. acosh ( ) }
626- /// Inverse hyperbolic tangent function.
627- #[ inline( always) ] pub fn atanh < T : Float > ( value : T ) -> T { value. atanh ( ) }
628-
629556/// A generic trait for converting a value to a number.
630557pub trait ToPrimitive {
631558 /// Converts the value of `self` to an `int`.
0 commit comments