Skip to content

Commit 1cb3314

Browse files
committed
Add type annotation required by rustc 2015-03-31
Resolves this error, which is fallout from rust-lang/rust#23673: src/structs/dmat.rs:501:43: 501:74 error: type annotations required: cannot resolve `<f64 as core::ops::Div<_>>::Output == f64` [E0284] src/structs/dmat.rs:501 let normalizer: N = Cast::from(1.0f64 / Cast::from(self.nrows)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Anders Kaseorg <[email protected]>
1 parent 1fc59cb commit 1cb3314

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ pub fn prepend_rotation<V, M: Rotation<V>>(m: &M, v: &V) -> M {
541541
/// use na::{BaseFloat, Rot3, Vec3};
542542
///
543543
/// fn main() {
544-
/// let t = Rot3::new(Vec3::new(0.0f64, 0.0, 0.5 * BaseFloat::pi()));
544+
/// let t = Rot3::new(Vec3::new(0.0f64, 0.0, 0.5 * <f64 as BaseFloat>::pi()));
545545
/// let v = Vec3::new(1.0, 0.0, 0.0);
546546
///
547547
/// let tv = na::rotate(&t, &v);
@@ -562,7 +562,7 @@ pub fn rotate<V, M: Rotate<V>>(m: &M, v: &V) -> V {
562562
/// use na::{BaseFloat, Rot3, Vec3};
563563
///
564564
/// fn main() {
565-
/// let t = Rot3::new(Vec3::new(0.0f64, 0.0, 0.5 * BaseFloat::pi()));
565+
/// let t = Rot3::new(Vec3::new(0.0f64, 0.0, 0.5 * <f64 as BaseFloat>::pi()));
566566
/// let v = Vec3::new(1.0, 0.0, 0.0);
567567
///
568568
/// let tv = na::inv_rotate(&t, &v);

src/structs/dmat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ impl<N: Clone + Copy> Transpose for DMat<N> {
498498
impl<N: BaseNum + Cast<f64> + Clone> Mean<DVec<N>> for DMat<N> {
499499
fn mean(&self) -> DVec<N> {
500500
let mut res: DVec<N> = DVec::new_zeros(self.ncols);
501-
let normalizer: N = Cast::from(1.0f64 / Cast::from(self.nrows));
501+
let normalizer: N = Cast::from(1.0f64 / self.nrows as f64);
502502

503503
for i in 0..self.nrows {
504504
for j in 0..self.ncols {

0 commit comments

Comments
 (0)