summary refs log tree commit diff
path: root/src/libtest
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-05-10 13:25:49 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-05-15 23:22:06 -0700
commitba0a984a862f4f4246a3be014b9b244525bedd20 (patch)
treed4fe59c7f09d1063289618312e8decb8c27c04e1 /src/libtest
parent4994f3cd455333749b8613b8cfc002e7397bf236 (diff)
downloadrust-ba0a984a862f4f4246a3be014b9b244525bedd20.tar.gz
rust-ba0a984a862f4f4246a3be014b9b244525bedd20.zip
core: Move intrinsic float functionality from std
The Float trait in libstd is quite a large trait which has dependencies on cmath
(libm) and such, which libcore cannot satisfy. It also has many functions that
libcore can implement, however, as LLVM has intrinsics or they're just bit
twiddling.

This commit moves what it can of the Float trait from the standard library into
libcore to allow floats to be usable in the core library. The remaining
functions are now resident in a FloatMath trait in the standard library (in the
prelude now). Previous code which was generic over just the Float trait may now
need to be generic over the FloatMath trait.

[breaking-change]
Diffstat (limited to 'src/libtest')
-rw-r--r--src/libtest/stats.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs
index bf40a2d601f..b3c768a5199 100644
--- a/src/libtest/stats.rs
+++ b/src/libtest/stats.rs
@@ -38,7 +38,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: Float + FromPrimitive>{
+pub trait Stats <T: FloatMath + FromPrimitive>{
 
     /// Sum of the samples.
     ///
@@ -143,7 +143,7 @@ pub struct Summary<T> {
     pub iqr: T,
 }
 
-impl<T: Float + FromPrimitive> Summary<T> {
+impl<T: FloatMath + FromPrimitive> Summary<T> {
 
     /// Construct a new summary of a sample set.
     pub fn new(samples: &[T]) -> Summary<T> {
@@ -164,7 +164,7 @@ impl<T: Float + FromPrimitive> Summary<T> {
     }
 }
 
-impl<'a,T: Float + FromPrimitive> Stats<T> for &'a [T] {
+impl<'a,T: FloatMath + FromPrimitive> Stats<T> for &'a [T] {
 
     // FIXME #11059 handle NaN, inf and overflow
     #[allow(deprecated_owned_vector)]