We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent df4503c commit cdc653dCopy full SHA for cdc653d
packages/std/src/math/fraction.rs
@@ -1,5 +1,3 @@
1
-use crate::Uint256;
2
-
3
/// A fraction `p`/`q` with integers `p` and `q`.
4
///
5
/// `p` is called the numerator and `q` is called the denominator.
@@ -15,7 +13,7 @@ pub trait Fraction<T>: Sized {
15
13
fn inv(&self) -> Option<Self>;
16
14
}
17
18
-impl<T: Copy + Into<Uint256>> Fraction<T> for (T, T) {
+impl<T: Copy + From<u8> + PartialEq> Fraction<T> for (T, T) {
19
fn numerator(&self) -> T {
20
self.0
21
@@ -25,7 +23,7 @@ impl<T: Copy + Into<Uint256>> Fraction<T> for (T, T) {
25
23
26
24
27
fn inv(&self) -> Option<Self> {
28
- if self.numerator().into() == Uint256::zero() {
+ if self.numerator() == 0u8.into() {
29
None
30
} else {
31
Some((self.1, self.0))
0 commit comments