aboutsummaryrefslogtreecommitdiff
path: root/src/stats/float.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/stats/float.rs')
-rwxr-xr-xsrc/stats/float.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/stats/float.rs b/src/stats/float.rs
new file mode 100755
index 0000000..b7748dd
--- /dev/null
+++ b/src/stats/float.rs
@@ -0,0 +1,15 @@
+//! Float trait
+
+use cast::From;
+use num_traits::float;
+
+/// This is an extension of `num_traits::float::Float` that adds safe
+/// casting and Sync + Send. Once `num_traits` has these features this
+/// can be removed.
+pub trait Float:
+ float::Float + From<usize, Output = Self> + From<f32, Output = Self> + Sync + Send
+{
+}
+
+impl Float for f32 {}
+impl Float for f64 {}