Add neg trait to BaseFloat

This commit is contained in:
Tinco Andringa 2015-05-08 21:03:13 +02:00
parent 350c8fb927
commit f0ce528903

View File

@ -2,7 +2,7 @@
use std::{f32, f64, i8, i16, i32, i64, u8, u16, u32, u64, isize, usize}; use std::{f32, f64, i8, i16, i32, i64, u8, u16, u32, u64, isize, usize};
use std::slice::{Iter, IterMut}; use std::slice::{Iter, IterMut};
use std::ops::{Add, Sub, Mul, Div, Rem, Index, IndexMut}; use std::ops::{Add, Sub, Mul, Div, Rem, Index, IndexMut, Neg};
use num::{Float, Zero, One}; use num::{Float, Zero, One};
use traits::operations::{RMul, LMul, Axpy, Transpose, Inv, Absolute}; use traits::operations::{RMul, LMul, Axpy, Transpose, Inv, Absolute};
use traits::geometry::{Dot, Norm, Orig}; use traits::geometry::{Dot, Norm, Orig};
@ -16,7 +16,7 @@ pub trait BaseNum: Copy + Zero + One +
} }
/// Basic floating-point number numeric trait. /// Basic floating-point number numeric trait.
pub trait BaseFloat: Float + Cast<f64> + BaseNum { pub trait BaseFloat: Float + Cast<f64> + BaseNum + Neg {
/// Archimedes' constant. /// Archimedes' constant.
fn pi() -> Self; fn pi() -> Self;
/// 2.0 * pi. /// 2.0 * pi.