mirror of
https://github.com/kmc7468/cs220.git
synced 2025-12-12 21:08:45 +00:00
@@ -6,7 +6,7 @@ use std::ops::*;
|
|||||||
/// Rational number represented by two isize, numerator and denominator.
|
/// Rational number represented by two isize, numerator and denominator.
|
||||||
///
|
///
|
||||||
/// Each Rational number should be normalized so that `demoninator` is nonnegative and `numerator` and `demoninator` are coprime.
|
/// Each Rational number should be normalized so that `demoninator` is nonnegative and `numerator` and `demoninator` are coprime.
|
||||||
/// See [`normalize`] for examples. As a corner case, 0 is represented by Rational { numerator: 0, demoninator: 0 }.
|
/// See `normalize` for examples. As a corner case, 0 is represented by Rational { numerator: 0, demoninator: 0 }.
|
||||||
///
|
///
|
||||||
/// For "natural use", Rational also overloads standard arithmetic operations, i.e, `+`, `-`, `*`, `/`.
|
/// For "natural use", Rational also overloads standard arithmetic operations, i.e, `+`, `-`, `*`, `/`.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use std::{iter::zip, ops::*};
|
|||||||
/// For example, the vector `vec![44,345,3]` represents the integer
|
/// For example, the vector `vec![44,345,3]` represents the integer
|
||||||
/// `44 * (2^32)^2 + 345 * (2^32) + 3`,
|
/// `44 * (2^32)^2 + 345 * (2^32) + 3`,
|
||||||
/// and the vector `vec![u32::MAX - 5, u32::MAX - 7]` represents the integer
|
/// and the vector `vec![u32::MAX - 5, u32::MAX - 7]` represents the integer
|
||||||
/// `- (5 * 2^32 + 8)
|
/// `- (5 * 2^32 + 8)`
|
||||||
///
|
///
|
||||||
/// You will implement the `Add` and `Sub` trait for this type.
|
/// You will implement the `Add` and `Sub` trait for this type.
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user