Skip to content

Commit 19ad60f

Browse files
committed
---
yaml --- r: 42728 b: refs/heads/try c: abb79cb h: refs/heads/master v: v3
1 parent 89ef194 commit 19ad60f

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
5-
refs/heads/try: 52975202afdd9858215f28e567940cb768c7c36c
5+
refs/heads/try: abb79cb52de957a9c634ee2f7192627d92dd697f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/src/libstd/cmp.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,30 @@ use core::float;
1818
const fuzzy_epsilon: float = 1.0e-6;
1919

2020
pub trait FuzzyEq {
21-
pure fn fuzzy_eq(other: &self) -> bool;
21+
pure fn fuzzy_eq(&self, other: &self) -> bool;
2222
}
2323

2424
impl float: FuzzyEq {
25-
pure fn fuzzy_eq(other: &float) -> bool {
26-
return float::abs(self - *other) < fuzzy_epsilon;
25+
pure fn fuzzy_eq(&self, other: &float) -> bool {
26+
float::abs(*self - *other) < fuzzy_epsilon
2727
}
2828
}
2929

3030
impl f32: FuzzyEq {
31-
pure fn fuzzy_eq(other: &f32) -> bool {
32-
return f32::abs(self - *other) < (fuzzy_epsilon as f32);
31+
pure fn fuzzy_eq(&self, other: &f32) -> bool {
32+
f32::abs(*self - *other) < (fuzzy_epsilon as f32)
3333
}
3434
}
3535

3636
impl f64: FuzzyEq {
37-
pure fn fuzzy_eq(other: &f64) -> bool {
38-
return f64::abs(self - *other) < (fuzzy_epsilon as f64);
37+
pure fn fuzzy_eq(&self, other: &f64) -> bool {
38+
f64::abs(*self - *other) < (fuzzy_epsilon as f64)
3939
}
4040
}
4141

4242
#[test]
4343
fn test_fuzzy_equals() {
44-
assert ((&1.0).fuzzy_eq(&1.0));
45-
assert ((&1.0f32).fuzzy_eq(&1.0f32));
46-
assert ((&1.0f64).fuzzy_eq(&1.0f64));
44+
assert (&1.0).fuzzy_eq(&1.0);
45+
assert (&1.0f32).fuzzy_eq(&1.0f32);
46+
assert (&1.0f64).fuzzy_eq(&1.0f64);
4747
}
48-

0 commit comments

Comments
 (0)