@@ -130,7 +130,7 @@ depending on the target pointer size.
130130
131131macro_rules! midpoint_impl {
132132 ( $SelfT: ty, unsigned) => {
133- /// Calculates the middle point of `self` and `rhs`.
133+ /// Calculates the midpoint (average) between `self` and `rhs`.
134134 ///
135135 /// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
136136 /// sufficiently-large unsigned integral type. This implies that the result is
@@ -146,6 +146,8 @@ macro_rules! midpoint_impl {
146146 #[ rustc_const_stable( feature = "num_midpoint" , since = "1.85.0" ) ]
147147 #[ must_use = "this returns the result of the operation, \
148148 without modifying the original"]
149+ #[ doc( alias = "average_floor" ) ]
150+ #[ doc( alias = "average" ) ]
149151 #[ inline]
150152 pub const fn midpoint( self , rhs: $SelfT) -> $SelfT {
151153 // Use the well known branchless algorithm from Hacker's Delight to compute
@@ -154,7 +156,7 @@ macro_rules! midpoint_impl {
154156 }
155157 } ;
156158 ( $SelfT: ty, signed) => {
157- /// Calculates the middle point of `self` and `rhs`.
159+ /// Calculates the midpoint (average) between `self` and `rhs`.
158160 ///
159161 /// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
160162 /// sufficiently-large signed integral type. This implies that the result is
@@ -173,6 +175,9 @@ macro_rules! midpoint_impl {
173175 #[ rustc_const_stable( feature = "num_midpoint_signed" , since = "1.87.0" ) ]
174176 #[ must_use = "this returns the result of the operation, \
175177 without modifying the original"]
178+ #[ doc( alias = "average_floor" ) ]
179+ #[ doc( alias = "average_ceil" ) ]
180+ #[ doc( alias = "average" ) ]
176181 #[ inline]
177182 pub const fn midpoint( self , rhs: Self ) -> Self {
178183 // Use the well known branchless algorithm from Hacker's Delight to compute
@@ -184,7 +189,7 @@ macro_rules! midpoint_impl {
184189 }
185190 } ;
186191 ( $SelfT: ty, $WideT: ty, unsigned) => {
187- /// Calculates the middle point of `self` and `rhs`.
192+ /// Calculates the midpoint (average) between `self` and `rhs`.
188193 ///
189194 /// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
190195 /// sufficiently-large unsigned integral type. This implies that the result is
@@ -200,13 +205,15 @@ macro_rules! midpoint_impl {
200205 #[ rustc_const_stable( feature = "num_midpoint" , since = "1.85.0" ) ]
201206 #[ must_use = "this returns the result of the operation, \
202207 without modifying the original"]
208+ #[ doc( alias = "average_floor" ) ]
209+ #[ doc( alias = "average" ) ]
203210 #[ inline]
204211 pub const fn midpoint( self , rhs: $SelfT) -> $SelfT {
205212 ( ( self as $WideT + rhs as $WideT) / 2 ) as $SelfT
206213 }
207214 } ;
208215 ( $SelfT: ty, $WideT: ty, signed) => {
209- /// Calculates the middle point of `self` and `rhs`.
216+ /// Calculates the midpoint (average) between `self` and `rhs`.
210217 ///
211218 /// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
212219 /// sufficiently-large signed integral type. This implies that the result is
@@ -225,6 +232,9 @@ macro_rules! midpoint_impl {
225232 #[ rustc_const_stable( feature = "num_midpoint_signed" , since = "1.87.0" ) ]
226233 #[ must_use = "this returns the result of the operation, \
227234 without modifying the original"]
235+ #[ doc( alias = "average_floor" ) ]
236+ #[ doc( alias = "average_ceil" ) ]
237+ #[ doc( alias = "average" ) ]
228238 #[ inline]
229239 pub const fn midpoint( self , rhs: $SelfT) -> $SelfT {
230240 ( ( self as $WideT + rhs as $WideT) / 2 ) as $SelfT
0 commit comments