about summary refs log tree commit diff
path: root/src/libextra
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-01-09 05:06:33 -0800
committerbors <bors@rust-lang.org>2014-01-09 05:06:33 -0800
commitab9ec6d59a0e5e79e553e0e4570a28ded1ead1aa (patch)
tree5e07a6413e9cd17fa3d5efcde3b2488b7c802478 /src/libextra
parentfb44e20f657302e9b69101d0c26b095636349d38 (diff)
parentceea85a148ec3426edfc00b8353a19c1d2df5dbf (diff)
downloadrust-ab9ec6d59a0e5e79e553e0e4570a28ded1ead1aa.tar.gz
rust-ab9ec6d59a0e5e79e553e0e4570a28ded1ead1aa.zip
auto merge of #11402 : bjz/rust/remove-approx, r=alexcrichton
This trait seems to stray too far from the mandate of a standard library as implementations may vary between use cases. Third party libraries should implement their own if they need something like it.

This closes #5316.

r? @alexcrichton, @pcwalton 
Diffstat (limited to 'src/libextra')
-rw-r--r--src/libextra/num/complex.rs2
-rw-r--r--src/libextra/stats.rs8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/libextra/num/complex.rs b/src/libextra/num/complex.rs
index 58af80fefb7..b4795c7e66b 100644
--- a/src/libextra/num/complex.rs
+++ b/src/libextra/num/complex.rs
@@ -268,7 +268,7 @@ mod test {
     #[test]
     fn test_arg() {
         fn test(c: Complex64, arg: f64) {
-            assert!(c.arg().approx_eq(&arg))
+            assert!((c.arg() - arg).abs() < 1.0e-6)
         }
         test(_1_0i, 0.0);
         test(_1_1i, 0.25 * Real::pi());
diff --git a/src/libextra/stats.rs b/src/libextra/stats.rs
index 7e715c82f9f..1d57e94035a 100644
--- a/src/libextra/stats.rs
+++ b/src/libextra/stats.rs
@@ -439,6 +439,14 @@ mod tests {
     use std::io;
     use std::str;
 
+    macro_rules! assert_approx_eq(
+        ($a:expr, $b:expr) => ({
+            let (a, b) = (&$a, &$b);
+            assert!((*a - *b).abs() < 1.0e-6,
+                    "{} is not approximately equal to {}", *a, *b);
+        })
+    )
+
     fn check(samples: &[f64], summ: &Summary) {
 
         let summ2 = Summary::new(samples);