Skip to content

Commit 3826493

Browse files
committed
std::ops::Div examples: correct nominator to numerator
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent 3750348 commit 3826493

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/libcore/ops/arith.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -220,21 +220,21 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
220220
/// // derive `Eq` and `PartialEq`.
221221
/// #[derive(Debug, Eq, PartialEq)]
222222
/// struct Rational {
223-
/// nominator: usize,
223+
/// numerator: usize,
224224
/// denominator: usize,
225225
/// }
226226
///
227227
/// impl Rational {
228-
/// fn new(nominator: usize, denominator: usize) -> Self {
228+
/// fn new(numerator: usize, denominator: usize) -> Self {
229229
/// if denominator == 0 {
230230
/// panic!("Zero is an invalid denominator!");
231231
/// }
232232
///
233233
/// // Reduce to lowest terms by dividing by the greatest common
234234
/// // divisor.
235-
/// let gcd = gcd(nominator, denominator);
235+
/// let gcd = gcd(numerator, denominator);
236236
/// Rational {
237-
/// nominator: nominator / gcd,
237+
/// numerator: numerator / gcd,
238238
/// denominator: denominator / gcd,
239239
/// }
240240
/// }
@@ -245,9 +245,9 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
245245
/// type Output = Self;
246246
///
247247
/// fn mul(self, rhs: Self) -> Self {
248-
/// let nominator = self.nominator * rhs.nominator;
248+
/// let numerator = self.numerator * rhs.numerator;
249249
/// let denominator = self.denominator * rhs.denominator;
250-
/// Rational::new(nominator, denominator)
250+
/// Rational::new(numerator, denominator)
251251
/// }
252252
/// }
253253
///
@@ -340,21 +340,21 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
340340
/// // derive `Eq` and `PartialEq`.
341341
/// #[derive(Debug, Eq, PartialEq)]
342342
/// struct Rational {
343-
/// nominator: usize,
343+
/// numerator: usize,
344344
/// denominator: usize,
345345
/// }
346346
///
347347
/// impl Rational {
348-
/// fn new(nominator: usize, denominator: usize) -> Self {
348+
/// fn new(numerator: usize, denominator: usize) -> Self {
349349
/// if denominator == 0 {
350350
/// panic!("Zero is an invalid denominator!");
351351
/// }
352352
///
353353
/// // Reduce to lowest terms by dividing by the greatest common
354354
/// // divisor.
355-
/// let gcd = gcd(nominator, denominator);
355+
/// let gcd = gcd(numerator, denominator);
356356
/// Rational {
357-
/// nominator: nominator / gcd,
357+
/// numerator: numerator / gcd,
358358
/// denominator: denominator / gcd,
359359
/// }
360360
/// }
@@ -365,13 +365,13 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }
365365
/// type Output = Self;
366366
///
367367
/// fn div(self, rhs: Self) -> Self::Output {
368-
/// if rhs.nominator == 0 {
368+
/// if rhs.numerator == 0 {
369369
/// panic!("Cannot divide by zero-valued `Rational`!");
370370
/// }
371371
///
372-
/// let nominator = self.nominator * rhs.denominator;
373-
/// let denominator = self.denominator * rhs.nominator;
374-
/// Rational::new(nominator, denominator)
372+
/// let numerator = self.numerator * rhs.denominator;
373+
/// let denominator = self.denominator * rhs.numerator;
374+
/// Rational::new(numerator, denominator)
375375
/// }
376376
/// }
377377
///

0 commit comments

Comments
 (0)