Merge pull request #139 from bjz/update

Update for rustc 0.13.0-nightly
This commit is contained in:
Brendan Zabarauskas 2014-11-16 02:03:07 +11:00
commit ce4ec62798
9 changed files with 13 additions and 5 deletions

View file

@ -16,7 +16,7 @@
//! Angle units for type-safe, self-documenting code. //! Angle units for type-safe, self-documenting code.
use std::fmt; use std::fmt;
use std::num::{One, one, Zero, zero, cast}; use std::num::{One, one, Zero, zero, cast, Float};
use approx::ApproxEq; use approx::ApproxEq;
use num::BaseFloat; use num::BaseFloat;

View file

@ -14,6 +14,7 @@
// limitations under the License. // limitations under the License.
use std::num; use std::num;
use std::num::Float;
pub trait ApproxEq<T: Float> { pub trait ApproxEq<T: Float> {
fn approx_epsilon(_hack: Option<Self>) -> T { fn approx_epsilon(_hack: Option<Self>) -> T {
@ -34,7 +35,7 @@ macro_rules! approx_float(
impl ApproxEq<$S> for $S { impl ApproxEq<$S> for $S {
#[inline] #[inline]
fn approx_eq_eps(&self, other: &$S, epsilon: &$S) -> bool { fn approx_eq_eps(&self, other: &$S, epsilon: &$S) -> bool {
num::abs(*self - *other) < *epsilon (*self - *other).abs() < *epsilon
} }
} }
) )

View file

@ -17,6 +17,7 @@ use approx::ApproxEq;
use std::cmp; use std::cmp;
use std::fmt; use std::fmt;
use std::num::{FloatMath, Int, Primitive};
/// A trait providing a [partial ordering](http://mathworld.wolfram.com/PartialOrder.html). /// A trait providing a [partial ordering](http://mathworld.wolfram.com/PartialOrder.html).
pub trait PartialOrd { pub trait PartialOrd {

View file

@ -15,7 +15,7 @@
use std::fmt; use std::fmt;
use std::mem; use std::mem;
use std::num::{zero, one, cast}; use std::num::{zero, one, cast, Float};
use angle::{Angle, Rad, acos, sin, sin_cos, rad}; use angle::{Angle, Rad, acos, sin, sin_cos, rad};
use approx::ApproxEq; use approx::ApproxEq;

View file

@ -138,6 +138,7 @@ pub trait Rotation3<S: BaseNum>: Rotation<S, Vector3<S>, Point3<S>>
/// use cgmath::{Matrix, ToMatrix2}; /// use cgmath::{Matrix, ToMatrix2};
/// use cgmath::{Rotation, Rotation2, Basis2}; /// use cgmath::{Rotation, Rotation2, Basis2};
/// use cgmath::ApproxEq; /// use cgmath::ApproxEq;
/// use std::num::Float;
/// ///
/// // For simplicity, we will rotate the unit x vector to the unit y vector -- /// // For simplicity, we will rotate the unit x vector to the unit y vector --
/// // so the angle is 90 degrees, or π/2. /// // so the angle is 90 degrees, or π/2.

View file

@ -18,6 +18,7 @@
extern crate cgmath; extern crate cgmath;
use cgmath::*; use cgmath::*;
use std::num::Float;
pub mod matrix2 { pub mod matrix2 {
use cgmath::*; use cgmath::*;

View file

@ -23,6 +23,8 @@ use cgmath::Quaternion;
use cgmath::{Rad, rad, ApproxEq}; use cgmath::{Rad, rad, ApproxEq};
use cgmath::Rotation3; use cgmath::Rotation3;
use std::num::Float;
#[test] #[test]
fn to_matrix4() fn to_matrix4()
{ {

View file

@ -18,6 +18,7 @@
extern crate cgmath; extern crate cgmath;
use cgmath::*; use cgmath::*;
use std::num::FloatMath;
#[test] #[test]
fn test_intersection() { fn test_intersection() {

View file

@ -18,6 +18,7 @@
extern crate cgmath; extern crate cgmath;
use cgmath::*; use cgmath::*;
use std::num::{Float, FloatMath};
#[test] #[test]
fn test_from_value() { fn test_from_value() {