Merge core::num::Float and std::num::FloatMath.

`FloatMath` no longer exists and all functionality from both traits is
available under `Float`. Change from

    use std::num::{Float, FloatMath};

to

    use std::num::Float;

[breaking-change]
This commit is contained in:
Huon Wilson 2015-01-05 21:14:50 +11:00
parent 1291fc76e0
commit ae4762761c
6 changed files with 443 additions and 36 deletions

View File

@ -19,12 +19,14 @@ use prelude::v1::*;
use intrinsics;
use libc::c_int;
use num::{Float, FloatMath};
use num::{Float, FpCategory};
use num::strconv;
use num::strconv::ExponentFormat::{ExpNone, ExpDec};
use num::strconv::SignificantDigits::{DigAll, DigMax, DigExact};
use num::strconv::SignFormat::SignNeg;
use core::num;
pub use core::f32::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE};
pub use core::f32::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP};
pub use core::f32::{MAX_10_EXP, NAN, INFINITY, NEG_INFINITY};
@ -72,7 +74,119 @@ mod cmath {
}
#[unstable = "trait is unstable"]
impl FloatMath for f32 {
impl Float for f32 {
#[inline]
fn nan() -> f32 { num::Float::nan() }
#[inline]
fn infinity() -> f32 { num::Float::infinity() }
#[inline]
fn neg_infinity() -> f32 { num::Float::neg_infinity() }
#[inline]
fn zero() -> f32 { num::Float::zero() }
#[inline]
fn neg_zero() -> f32 { num::Float::neg_zero() }
#[inline]
fn one() -> f32 { num::Float::one() }
#[allow(deprecated)]
#[inline]
fn mantissa_digits(unused_self: Option<f32>) -> uint {
num::Float::mantissa_digits(unused_self)
}
#[allow(deprecated)]
#[inline]
fn digits(unused_self: Option<f32>) -> uint { num::Float::digits(unused_self) }
#[allow(deprecated)]
#[inline]
fn epsilon() -> f32 { num::Float::epsilon() }
#[allow(deprecated)]
#[inline]
fn min_exp(unused_self: Option<f32>) -> int { num::Float::min_exp(unused_self) }
#[allow(deprecated)]
#[inline]
fn max_exp(unused_self: Option<f32>) -> int { num::Float::max_exp(unused_self) }
#[allow(deprecated)]
#[inline]
fn min_10_exp(unused_self: Option<f32>) -> int { num::Float::min_10_exp(unused_self) }
#[allow(deprecated)]
#[inline]
fn max_10_exp(unused_self: Option<f32>) -> int { num::Float::max_10_exp(unused_self) }
#[allow(deprecated)]
#[inline]
fn min_value() -> f32 { num::Float::min_value() }
#[allow(deprecated)]
#[inline]
fn min_pos_value(unused_self: Option<f32>) -> f32 { num::Float::min_pos_value(unused_self) }
#[allow(deprecated)]
#[inline]
fn max_value() -> f32 { num::Float::max_value() }
#[inline]
fn is_nan(self) -> bool { num::Float::is_nan(self) }
#[inline]
fn is_infinite(self) -> bool { num::Float::is_infinite(self) }
#[inline]
fn is_finite(self) -> bool { num::Float::is_finite(self) }
#[inline]
fn is_normal(self) -> bool { num::Float::is_normal(self) }
#[inline]
fn classify(self) -> FpCategory { num::Float::classify(self) }
#[inline]
fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self) }
#[inline]
fn floor(self) -> f32 { num::Float::floor(self) }
#[inline]
fn ceil(self) -> f32 { num::Float::ceil(self) }
#[inline]
fn round(self) -> f32 { num::Float::round(self) }
#[inline]
fn trunc(self) -> f32 { num::Float::trunc(self) }
#[inline]
fn fract(self) -> f32 { num::Float::fract(self) }
#[inline]
fn abs(self) -> f32 { num::Float::abs(self) }
#[inline]
fn signum(self) -> f32 { num::Float::signum(self) }
#[inline]
fn is_positive(self) -> bool { num::Float::is_positive(self) }
#[inline]
fn is_negative(self) -> bool { num::Float::is_negative(self) }
#[inline]
fn mul_add(self, a: f32, b: f32) -> f32 { num::Float::mul_add(self, a, b) }
#[inline]
fn recip(self) -> f32 { num::Float::recip(self) }
#[inline]
fn powi(self, n: i32) -> f32 { num::Float::powi(self, n) }
#[inline]
fn powf(self, n: f32) -> f32 { num::Float::powf(self, n) }
#[inline]
fn sqrt(self) -> f32 { num::Float::sqrt(self) }
#[inline]
fn rsqrt(self) -> f32 { num::Float::rsqrt(self) }
#[inline]
fn exp(self) -> f32 { num::Float::exp(self) }
#[inline]
fn exp2(self) -> f32 { num::Float::exp(self) }
#[inline]
fn ln(self) -> f32 { num::Float::ln(self) }
#[inline]
fn log(self, base: f32) -> f32 { num::Float::log(self, base) }
#[inline]
fn log2(self) -> f32 { num::Float::log2(self) }
#[inline]
fn log10(self) -> f32 { num::Float::log10(self) }
#[inline]
fn to_degrees(self) -> f32 { num::Float::to_degrees(self) }
#[inline]
fn to_radians(self) -> f32 { num::Float::to_radians(self) }
/// Constructs a floating point number by multiplying `x` by 2 raised to the
/// power of `exp`
#[inline]
@ -639,18 +753,18 @@ mod tests {
// are supported in floating-point literals
let f1: f32 = FromStrRadix::from_str_radix("1p-123", 16).unwrap();
let f2: f32 = FromStrRadix::from_str_radix("1p-111", 16).unwrap();
assert_eq!(FloatMath::ldexp(1f32, -123), f1);
assert_eq!(FloatMath::ldexp(1f32, -111), f2);
assert_eq!(Float::ldexp(1f32, -123), f1);
assert_eq!(Float::ldexp(1f32, -111), f2);
assert_eq!(FloatMath::ldexp(0f32, -123), 0f32);
assert_eq!(FloatMath::ldexp(-0f32, -123), -0f32);
assert_eq!(Float::ldexp(0f32, -123), 0f32);
assert_eq!(Float::ldexp(-0f32, -123), -0f32);
let inf: f32 = Float::infinity();
let neg_inf: f32 = Float::neg_infinity();
let nan: f32 = Float::nan();
assert_eq!(FloatMath::ldexp(inf, -123), inf);
assert_eq!(FloatMath::ldexp(neg_inf, -123), neg_inf);
assert!(FloatMath::ldexp(nan, -123).is_nan());
assert_eq!(Float::ldexp(inf, -123), inf);
assert_eq!(Float::ldexp(neg_inf, -123), neg_inf);
assert!(Float::ldexp(nan, -123).is_nan());
}
#[test]
@ -663,8 +777,8 @@ mod tests {
let (x2, exp2) = f2.frexp();
assert_eq!((x1, exp1), (0.5f32, -122));
assert_eq!((x2, exp2), (0.5f32, -110));
assert_eq!(FloatMath::ldexp(x1, exp1), f1);
assert_eq!(FloatMath::ldexp(x2, exp2), f2);
assert_eq!(Float::ldexp(x1, exp1), f1);
assert_eq!(Float::ldexp(x2, exp2), f2);
assert_eq!(0f32.frexp(), (0f32, 0));
assert_eq!((-0f32).frexp(), (-0f32, 0));

View File

@ -18,12 +18,14 @@ use prelude::v1::*;
use intrinsics;
use libc::c_int;
use num::{Float, FloatMath};
use num::{Float, FpCategory};
use num::strconv;
use num::strconv::ExponentFormat::{ExpNone, ExpDec};
use num::strconv::SignificantDigits::{DigAll, DigMax, DigExact};
use num::strconv::SignFormat::SignNeg;
use core::num;
pub use core::f64::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE};
pub use core::f64::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP};
pub use core::f64::{MAX_10_EXP, NAN, INFINITY, NEG_INFINITY};
@ -80,9 +82,122 @@ mod cmath {
}
#[unstable = "trait is unstable"]
impl FloatMath for f64 {
/// Constructs a floating point number by multiplying `x` by 2 raised to the
/// power of `exp`
impl Float for f64 {
// inlined methods from `num::Float`
#[inline]
fn nan() -> f64 { num::Float::nan() }
#[inline]
fn infinity() -> f64 { num::Float::infinity() }
#[inline]
fn neg_infinity() -> f64 { num::Float::neg_infinity() }
#[inline]
fn zero() -> f64 { num::Float::zero() }
#[inline]
fn neg_zero() -> f64 { num::Float::neg_zero() }
#[inline]
fn one() -> f64 { num::Float::one() }
#[allow(deprecated)]
#[inline]
fn mantissa_digits(unused_self: Option<f64>) -> uint {
num::Float::mantissa_digits(unused_self)
}
#[allow(deprecated)]
#[inline]
fn digits(unused_self: Option<f64>) -> uint { num::Float::digits(unused_self) }
#[allow(deprecated)]
#[inline]
fn epsilon() -> f64 { num::Float::epsilon() }
#[allow(deprecated)]
#[inline]
fn min_exp(unused_self: Option<f64>) -> int { num::Float::min_exp(unused_self) }
#[allow(deprecated)]
#[inline]
fn max_exp(unused_self: Option<f64>) -> int { num::Float::max_exp(unused_self) }
#[allow(deprecated)]
#[inline]
fn min_10_exp(unused_self: Option<f64>) -> int { num::Float::min_10_exp(unused_self) }
#[allow(deprecated)]
#[inline]
fn max_10_exp(unused_self: Option<f64>) -> int { num::Float::max_10_exp(unused_self) }
#[allow(deprecated)]
#[inline]
fn min_value() -> f64 { num::Float::min_value() }
#[allow(deprecated)]
#[inline]
fn min_pos_value(unused_self: Option<f64>) -> f64 { num::Float::min_pos_value(unused_self) }
#[allow(deprecated)]
#[inline]
fn max_value() -> f64 { num::Float::max_value() }
#[inline]
fn is_nan(self) -> bool { num::Float::is_nan(self) }
#[inline]
fn is_infinite(self) -> bool { num::Float::is_infinite(self) }
#[inline]
fn is_finite(self) -> bool { num::Float::is_finite(self) }
#[inline]
fn is_normal(self) -> bool { num::Float::is_normal(self) }
#[inline]
fn classify(self) -> FpCategory { num::Float::classify(self) }
#[inline]
fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self) }
#[inline]
fn floor(self) -> f64 { num::Float::floor(self) }
#[inline]
fn ceil(self) -> f64 { num::Float::ceil(self) }
#[inline]
fn round(self) -> f64 { num::Float::round(self) }
#[inline]
fn trunc(self) -> f64 { num::Float::trunc(self) }
#[inline]
fn fract(self) -> f64 { num::Float::fract(self) }
#[inline]
fn abs(self) -> f64 { num::Float::abs(self) }
#[inline]
fn signum(self) -> f64 { num::Float::signum(self) }
#[inline]
fn is_positive(self) -> bool { num::Float::is_positive(self) }
#[inline]
fn is_negative(self) -> bool { num::Float::is_negative(self) }
#[inline]
fn mul_add(self, a: f64, b: f64) -> f64 { num::Float::mul_add(self, a, b) }
#[inline]
fn recip(self) -> f64 { num::Float::recip(self) }
#[inline]
fn powi(self, n: i32) -> f64 { num::Float::powi(self, n) }
#[inline]
fn powf(self, n: f64) -> f64 { num::Float::powf(self, n) }
#[inline]
fn sqrt(self) -> f64 { num::Float::sqrt(self) }
#[inline]
fn rsqrt(self) -> f64 { num::Float::rsqrt(self) }
#[inline]
fn exp(self) -> f64 { num::Float::exp(self) }
#[inline]
fn exp2(self) -> f64 { num::Float::exp(self) }
#[inline]
fn ln(self) -> f64 { num::Float::ln(self) }
#[inline]
fn log(self, base: f64) -> f64 { num::Float::log(self, base) }
#[inline]
fn log2(self) -> f64 { num::Float::log2(self) }
#[inline]
fn log10(self) -> f64 { num::Float::log10(self) }
#[inline]
fn to_degrees(self) -> f64 { num::Float::to_degrees(self) }
#[inline]
fn to_radians(self) -> f64 { num::Float::to_radians(self) }
#[inline]
fn ldexp(x: f64, exp: int) -> f64 {
unsafe { cmath::ldexp(x, exp as c_int) }
@ -640,18 +755,18 @@ mod tests {
// are supported in floating-point literals
let f1: f64 = FromStrRadix::from_str_radix("1p-123", 16).unwrap();
let f2: f64 = FromStrRadix::from_str_radix("1p-111", 16).unwrap();
assert_eq!(FloatMath::ldexp(1f64, -123), f1);
assert_eq!(FloatMath::ldexp(1f64, -111), f2);
assert_eq!(Float::ldexp(1f64, -123), f1);
assert_eq!(Float::ldexp(1f64, -111), f2);
assert_eq!(FloatMath::ldexp(0f64, -123), 0f64);
assert_eq!(FloatMath::ldexp(-0f64, -123), -0f64);
assert_eq!(Float::ldexp(0f64, -123), 0f64);
assert_eq!(Float::ldexp(-0f64, -123), -0f64);
let inf: f64 = Float::infinity();
let neg_inf: f64 = Float::neg_infinity();
let nan: f64 = Float::nan();
assert_eq!(FloatMath::ldexp(inf, -123), inf);
assert_eq!(FloatMath::ldexp(neg_inf, -123), neg_inf);
assert!(FloatMath::ldexp(nan, -123).is_nan());
assert_eq!(Float::ldexp(inf, -123), inf);
assert_eq!(Float::ldexp(neg_inf, -123), neg_inf);
assert!(Float::ldexp(nan, -123).is_nan());
}
#[test]
@ -664,8 +779,8 @@ mod tests {
let (x2, exp2) = f2.frexp();
assert_eq!((x1, exp1), (0.5f64, -122));
assert_eq!((x2, exp2), (0.5f64, -110));
assert_eq!(FloatMath::ldexp(x1, exp1), f1);
assert_eq!(FloatMath::ldexp(x2, exp2), f2);
assert_eq!(Float::ldexp(x1, exp1), f1);
assert_eq!(Float::ldexp(x2, exp2), f2);
assert_eq!(0f64.frexp(), (0f64, 0));
assert_eq!((-0f64).frexp(), (-0f64, 0));

View File

@ -16,10 +16,12 @@
#![stable]
#![allow(missing_docs)]
#[cfg(test)] use cmp::PartialEq;
#[cfg(test)] use fmt::Show;
#[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem};
#[cfg(test)] use kinds::Copy;
use ops::{Add, Sub, Mul, Div, Rem, Neg};
use kinds::Copy;
use clone::Clone;
use cmp::{PartialOrd, PartialEq};
pub use core::num::{Int, SignedInt, UnsignedInt};
pub use core::num::{cast, FromPrimitive, NumCast, ToPrimitive};
@ -27,14 +29,190 @@ pub use core::num::{from_int, from_i8, from_i16, from_i32, from_i64};
pub use core::num::{from_uint, from_u8, from_u16, from_u32, from_u64};
pub use core::num::{from_f32, from_f64};
pub use core::num::{FromStrRadix, from_str_radix};
pub use core::num::{FpCategory, Float};
pub use core::num::{FpCategory};
use option::Option;
#[experimental = "may be removed or relocated"]
pub mod strconv;
/// Mathematical operations on primitive floating point numbers.
#[unstable = "may be altered to inline the Float trait"]
pub trait FloatMath: Float {
pub trait Float
: Copy + Clone
+ NumCast
+ PartialOrd
+ PartialEq
+ Neg<Output=Self>
+ Add<Output=Self>
+ Sub<Output=Self>
+ Mul<Output=Self>
+ Div<Output=Self>
+ Rem<Output=Self>
{
// inlined methods from `num::Float`
/// Returns the NaN value.
#[unstable = "unsure about its place in the world"]
fn nan() -> Self;
/// Returns the infinite value.
#[unstable = "unsure about its place in the world"]
fn infinity() -> Self;
/// Returns the negative infinite value.
#[unstable = "unsure about its place in the world"]
fn neg_infinity() -> Self;
/// Returns the `0` value.
#[unstable = "unsure about its place in the world"]
fn zero() -> Self;
/// Returns -0.0.
#[unstable = "unsure about its place in the world"]
fn neg_zero() -> Self;
/// Returns the `1` value.
#[unstable = "unsure about its place in the world"]
fn one() -> Self;
// FIXME (#5527): These should be associated constants
/// Returns the number of binary digits of mantissa that this type supports.
#[deprecated = "use `std::f32::MANTISSA_DIGITS` or `std::f64::MANTISSA_DIGITS` as appropriate"]
fn mantissa_digits(unused_self: Option<Self>) -> uint;
/// Returns the number of base-10 digits of precision that this type supports.
#[deprecated = "use `std::f32::DIGITS` or `std::f64::DIGITS` as appropriate"]
fn digits(unused_self: Option<Self>) -> uint;
/// Returns the difference between 1.0 and the smallest representable number larger than 1.0.
#[deprecated = "use `std::f32::EPSILON` or `std::f64::EPSILON` as appropriate"]
fn epsilon() -> Self;
/// Returns the minimum binary exponent that this type can represent.
#[deprecated = "use `std::f32::MIN_EXP` or `std::f64::MIN_EXP` as appropriate"]
fn min_exp(unused_self: Option<Self>) -> int;
/// Returns the maximum binary exponent that this type can represent.
#[deprecated = "use `std::f32::MAX_EXP` or `std::f64::MAX_EXP` as appropriate"]
fn max_exp(unused_self: Option<Self>) -> int;
/// Returns the minimum base-10 exponent that this type can represent.
#[deprecated = "use `std::f32::MIN_10_EXP` or `std::f64::MIN_10_EXP` as appropriate"]
fn min_10_exp(unused_self: Option<Self>) -> int;
/// Returns the maximum base-10 exponent that this type can represent.
#[deprecated = "use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` as appropriate"]
fn max_10_exp(unused_self: Option<Self>) -> int;
/// Returns the smallest finite value that this type can represent.
#[deprecated = "use `std::f32::MIN_VALUE` or `std::f64::MIN_VALUE` as appropriate"]
fn min_value() -> Self;
/// Returns the smallest normalized positive number that this type can represent.
#[deprecated = "use `std::f32::MIN_POS_VALUE` or `std::f64::MIN_POS_VALUE` as appropriate"]
fn min_pos_value(unused_self: Option<Self>) -> Self;
/// Returns the largest finite value that this type can represent.
#[deprecated = "use `std::f32::MAX_VALUE` or `std::f64::MAX_VALUE` as appropriate"]
fn max_value() -> Self;
/// Returns true if this value is NaN and false otherwise.
#[stable]
fn is_nan(self) -> bool;
/// Returns true if this value is positive infinity or negative infinity and
/// false otherwise.
#[stable]
fn is_infinite(self) -> bool;
/// Returns true if this number is neither infinite nor NaN.
#[stable]
fn is_finite(self) -> bool;
/// Returns true if this number is neither zero, infinite, denormal, or NaN.
#[stable]
fn is_normal(self) -> bool;
/// Returns the category that this number falls into.
#[stable]
fn classify(self) -> FpCategory;
/// Returns the mantissa, exponent and sign as integers, respectively.
#[stable]
fn integer_decode(self) -> (u64, i16, i8);
/// Return the largest integer less than or equal to a number.
#[unstable = "TODO"]
fn floor(self) -> Self;
/// Return the smallest integer greater than or equal to a number.
#[unstable = "TODO"]
fn ceil(self) -> Self;
/// Return the nearest integer to a number. Round half-way cases away from
/// `0.0`.
#[unstable = "TODO"]
fn round(self) -> Self;
/// Return the integer part of a number.
#[unstable = "TODO"]
fn trunc(self) -> Self;
/// Return the fractional part of a number.
#[unstable = "TODO"]
fn fract(self) -> Self;
/// Computes the absolute value of `self`. Returns `Float::nan()` if the
/// number is `Float::nan()`.
#[unstable = "TODO"]
fn abs(self) -> Self;
/// Returns a number that represents the sign of `self`.
///
/// - `1.0` if the number is positive, `+0.0` or `Float::infinity()`
/// - `-1.0` if the number is negative, `-0.0` or `Float::neg_infinity()`
/// - `Float::nan()` if the number is `Float::nan()`
#[stable]
fn signum(self) -> Self;
/// Returns `true` if `self` is positive, including `+0.0` and
/// `Float::infinity()`.
#[stable]
fn is_positive(self) -> bool;
/// Returns `true` if `self` is negative, including `-0.0` and
/// `Float::neg_infinity()`.
#[stable]
fn is_negative(self) -> bool;
/// Fused multiply-add. Computes `(self * a) + b` with only one rounding
/// error. This produces a more accurate result with better performance than
/// a separate multiplication operation followed by an add.
#[stable]
fn mul_add(self, a: Self, b: Self) -> Self;
/// Take the reciprocal (inverse) of a number, `1/x`.
#[stable]
fn recip(self) -> Self;
/// Raise a number to an integer power.
///
/// Using this function is generally faster than using `powf`
#[unstable = "TODO"]
fn powi(self, n: i32) -> Self;
/// Raise a number to a floating point power.
#[unstable = "TODO"]
fn powf(self, n: Self) -> Self;
/// Take the square root of a number.
///
/// Returns NaN if `self` is a negative number.
#[unstable = "TODO"]
fn sqrt(self) -> Self;
/// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
#[unstable = "TODO"]
fn rsqrt(self) -> Self;
/// Returns `e^(self)`, (the exponential function).
#[unstable = "TODO"]
fn exp(self) -> Self;
/// Returns 2 raised to the power of the number, `2^(self)`.
#[unstable = "TODO"]
fn exp2(self) -> Self;
/// Returns the natural logarithm of the number.
#[unstable = "TODO"]
fn ln(self) -> Self;
/// Returns the logarithm of the number with respect to an arbitrary base.
#[unstable = "TODO"]
fn log(self, base: Self) -> Self;
/// Returns the base 2 logarithm of the number.
#[unstable = "TODO"]
fn log2(self) -> Self;
/// Returns the base 10 logarithm of the number.
#[unstable = "TODO"]
fn log10(self) -> Self;
/// Convert radians to degrees.
#[unstable = "TODO"]
fn to_degrees(self) -> Self;
/// Convert degrees to radians.
#[unstable = "TODO"]
fn to_radians(self) -> Self;
/// Constructs a floating point number created by multiplying `x` by 2
/// raised to the power of `exp`.
fn ldexp(x: Self, exp: int) -> Self;

View File

@ -69,7 +69,7 @@ use std::io::stdio::StdWriter;
use std::io::{File, ChanReader, ChanWriter};
use std::io;
use std::iter::repeat;
use std::num::{Float, FloatMath, Int};
use std::num::{Float, Int};
use std::os;
use std::str::FromStr;
use std::sync::mpsc::{channel, Sender};

View File

@ -17,7 +17,7 @@ use std::fmt::Show;
use std::hash::Hash;
use std::io;
use std::mem;
use std::num::{Float, FloatMath, FromPrimitive};
use std::num::{Float, FromPrimitive};
fn local_cmp<T:Float>(x: T, y: T) -> Ordering {
// arbitrarily decide that NaNs are larger than everything.
@ -39,7 +39,7 @@ fn local_sort<T: Float>(v: &mut [T]) {
}
/// Trait that provides simple descriptive statistics on a univariate set of numeric samples.
pub trait Stats <T: FloatMath + FromPrimitive> {
pub trait Stats <T: Float + FromPrimitive> {
/// Sum of the samples.
///
@ -144,7 +144,7 @@ pub struct Summary<T> {
pub iqr: T,
}
impl<T: FloatMath + FromPrimitive> Summary<T> {
impl<T: Float + FromPrimitive> Summary<T> {
/// Construct a new summary of a sample set.
pub fn new(samples: &[T]) -> Summary<T> {
Summary {
@ -164,7 +164,7 @@ impl<T: FloatMath + FromPrimitive> Summary<T> {
}
}
impl<T: FloatMath + FromPrimitive> Stats<T> for [T] {
impl<T: Float + FromPrimitive> Stats<T> for [T] {
// FIXME #11059 handle NaN, inf and overflow
fn sum(&self) -> T {
let mut partials = vec![];

View File

@ -13,7 +13,7 @@
// ignore-lexer-test FIXME #15679
use std::f32::consts::PI;
use std::num::{Float, FloatMath};
use std::num::Float;
use std::rand::{Rng, StdRng};
struct Vec2 {