@@ -199,10 +199,14 @@ pub trait Integer: Sized + Num + PartialOrd + Ord + Eq {
199199 ///
200200 /// ~~~
201201 /// # use num_integer::Integer;
202- /// assert_eq!(16.next_multiple_of(& 8), 16);
203- /// assert_eq!(23.next_multiple_of(& 8), 24);
204- /// assert_eq!(16.next_multiple_of(&-8), 16);
205- /// assert_eq!(23.next_multiple_of(&-8), 16);
202+ /// assert_eq!(( 16).next_multiple_of(& 8), 16);
203+ /// assert_eq!(( 23).next_multiple_of(& 8), 24);
204+ /// assert_eq!(( 16).next_multiple_of(&-8), 16);
205+ /// assert_eq!(( 23).next_multiple_of(&-8), 16);
206+ /// assert_eq!((-16).next_multiple_of(& 8), -16);
207+ /// assert_eq!((-23).next_multiple_of(& 8), -16);
208+ /// assert_eq!((-16).next_multiple_of(&-8), -16);
209+ /// assert_eq!((-23).next_multiple_of(&-8), -24);
206210 /// ~~~
207211 #[ inline]
208212 fn next_multiple_of ( & self , other : & Self ) -> Self where Self : Clone {
@@ -216,13 +220,17 @@ pub trait Integer: Sized + Num + PartialOrd + Ord + Eq {
216220 ///
217221 /// ~~~
218222 /// # use num_integer::Integer;
219- /// assert_eq!(16.next_multiple_back_of(& 8), 16);
220- /// assert_eq!(23.next_multiple_back_of(& 8), 16);
221- /// assert_eq!(16.next_multiple_back_of(&-8), 16);
222- /// assert_eq!(23.next_multiple_back_of(&-8), 24);
223+ /// assert_eq!(( 16).prev_multiple_of(& 8), 16);
224+ /// assert_eq!(( 23).prev_multiple_of(& 8), 16);
225+ /// assert_eq!(( 16).prev_multiple_of(&-8), 16);
226+ /// assert_eq!(( 23).prev_multiple_of(&-8), 24);
227+ /// assert_eq!((-16).prev_multiple_of(& 8), -16);
228+ /// assert_eq!((-23).prev_multiple_of(& 8), -24);
229+ /// assert_eq!((-16).prev_multiple_of(&-8), -16);
230+ /// assert_eq!((-23).prev_multiple_of(&-8), -16);
223231 /// ~~~
224232 #[ inline]
225- fn next_multiple_back_of ( & self , other : & Self ) -> Self where Self : Clone {
233+ fn prev_multiple_of ( & self , other : & Self ) -> Self where Self : Clone {
226234 self . clone ( ) - self . mod_floor ( other)
227235 }
228236}
0 commit comments