1
1
use core:: ops:: { Div , Rem } ;
2
- use float:: Float ;
3
2
pub trait DivRemEuclid : Sized + Div < Self , Output = Self > + Rem < Self , Output = Self > {
4
3
/// Calculates Euclidean division, the matching method for `rem_euclid`.
5
4
///
@@ -70,7 +69,7 @@ div_rem_euclid_impl!(DivRemEuclid for i128 u128);
70
69
#[ cfg( any( feature = "std" , feature = "libm" ) ) ]
71
70
impl DivRemEuclid for f32 {
72
71
fn div_euclid ( & self , rhs : & f32 ) -> f32 {
73
- let q = <f32 as Float >:: trunc ( self / rhs) ;
72
+ let q = <f32 as :: Float >:: trunc ( self / rhs) ;
74
73
if self % rhs < 0.0 {
75
74
return if * rhs > 0.0 { q - 1.0 } else { q + 1.0 } ;
76
75
}
@@ -80,7 +79,7 @@ impl DivRemEuclid for f32 {
80
79
fn rem_euclid ( & self , rhs : & f32 ) -> f32 {
81
80
let r = self % rhs;
82
81
if r < 0.0 {
83
- r + <f32 as Float >:: abs ( * rhs)
82
+ r + <f32 as :: Float >:: abs ( * rhs)
84
83
} else {
85
84
r
86
85
}
@@ -90,7 +89,7 @@ impl DivRemEuclid for f32 {
90
89
#[ cfg( any( feature = "std" , feature = "libm" ) ) ]
91
90
impl DivRemEuclid for f64 {
92
91
fn div_euclid ( & self , rhs : & f64 ) -> f64 {
93
- let q = <f64 as Float >:: trunc ( self / rhs) ;
92
+ let q = <f64 as :: Float >:: trunc ( self / rhs) ;
94
93
if self % rhs < 0.0 {
95
94
return if * rhs > 0.0 { q - 1.0 } else { q + 1.0 } ;
96
95
}
@@ -100,7 +99,7 @@ impl DivRemEuclid for f64 {
100
99
fn rem_euclid ( & self , rhs : & f64 ) -> f64 {
101
100
let r = self % rhs;
102
101
if r < 0.0 {
103
- r + <f64 as Float >:: abs ( * rhs)
102
+ r + <f64 as :: Float >:: abs ( * rhs)
104
103
} else {
105
104
r
106
105
}
0 commit comments