@@ -32,9 +32,9 @@ checked_impl!(CheckedAdd, checked_add, i64);
32
32
checked_impl ! ( CheckedAdd , checked_add, isize ) ;
33
33
checked_impl ! ( CheckedAdd , checked_add, i128 ) ;
34
34
35
- /// Performs subtraction, returning `None` if underflow occurred.
35
+ /// Performs subtraction, returning `None` if overflow occurred.
36
36
pub trait CheckedSub : Sized + Sub < Self , Output = Self > {
37
- /// Subtracts two numbers, checking for underflow . If underflow happens,
37
+ /// Subtracts two numbers, checking for overflow . If overflow happens,
38
38
/// `None` is returned.
39
39
fn checked_sub ( & self , v : & Self ) -> Option < Self > ;
40
40
}
@@ -53,11 +53,10 @@ checked_impl!(CheckedSub, checked_sub, i64);
53
53
checked_impl ! ( CheckedSub , checked_sub, isize ) ;
54
54
checked_impl ! ( CheckedSub , checked_sub, i128 ) ;
55
55
56
- /// Performs multiplication, returning `None` if underflow or overflow
57
- /// occurred.
56
+ /// Performs multiplication, returning `None` if overflow occurred.
58
57
pub trait CheckedMul : Sized + Mul < Self , Output = Self > {
59
- /// Multiplies two numbers, checking for underflow or overflow. If underflow
60
- /// or overflow happens, `None` is returned.
58
+ /// Multiplies two numbers, checking for overflow. If overflow happens,
59
+ /// `None` is returned.
61
60
fn checked_mul ( & self , v : & Self ) -> Option < Self > ;
62
61
}
63
62
@@ -75,10 +74,10 @@ checked_impl!(CheckedMul, checked_mul, i64);
75
74
checked_impl ! ( CheckedMul , checked_mul, isize ) ;
76
75
checked_impl ! ( CheckedMul , checked_mul, i128 ) ;
77
76
78
- /// Performs division, returning `None` on division by zero or if underflow or
79
- /// overflow occurred.
77
+ /// Performs division, returning `None` on division by zero or if overflow
78
+ /// occurred.
80
79
pub trait CheckedDiv : Sized + Div < Self , Output = Self > {
81
- /// Divides two numbers, checking for underflow, overflow and division by
80
+ /// Divides two numbers, checking for overflow and division by
82
81
/// zero. If any of that happens, `None` is returned.
83
82
fn checked_div ( & self , v : & Self ) -> Option < Self > ;
84
83
}
@@ -98,10 +97,10 @@ checked_impl!(CheckedDiv, checked_div, isize);
98
97
checked_impl ! ( CheckedDiv , checked_div, i128 ) ;
99
98
100
99
/// Performs integral remainder, returning `None` on division by zero or if
101
- /// underflow or overflow occurred.
100
+ /// overflow occurred.
102
101
pub trait CheckedRem : Sized + Rem < Self , Output = Self > {
103
- /// Finds the remainder of dividing two numbers, checking for underflow, overflow and division
104
- /// by zero. If any of that happens, `None` is returned.
102
+ /// Finds the remainder of dividing two numbers, checking for overflow and
103
+ /// division by zero. If any of that happens, `None` is returned.
105
104
///
106
105
/// # Examples
107
106
///
0 commit comments