Skip to content

Commit 2c1d7dc

Browse files
committed
Use the newly added ONE constant in float addition
1 parent 46cfa05 commit 2c1d7dc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/float/add.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
use core::num::Wrapping;
22

3+
use int::Int;
34
use float::Float;
45

56
/// Returns `a + b`
67
macro_rules! add {
78
($a:expr, $b:expr, $ty:ty) => ({
89
let a = $a;
910
let b = $b;
10-
let one = Wrapping(1 as <$ty as Float>::Int);
11-
let zero = Wrapping(0 as <$ty as Float>::Int);
11+
let one = Wrapping(<$ty as Float>::Int::ONE);
12+
let zero = Wrapping(<$ty as Float>::Int::ZERO);
1213

1314
let bits = Wrapping(<$ty>::BITS as <$ty as Float>::Int);
1415
let significand_bits = Wrapping(<$ty>::SIGNIFICAND_BITS as <$ty as Float>::Int);

0 commit comments

Comments
 (0)