1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
use super::BigInt;
impl BigInt {
#[inline]
pub(crate) fn same_value_zero(x: &Self, y: &Self) -> bool {
Self::equal(x, y)
}
#[inline]
pub(crate) fn same_value(x: &Self, y: &Self) -> bool {
Self::equal(x, y)
}
#[inline]
pub(crate) fn equal(x: &Self, y: &Self) -> bool {
x == y
}
}
impl PartialEq<i32> for BigInt {
fn eq(&self, other: &i32) -> bool {
self.0 == num_bigint::BigInt::from(*other)
}
}
impl PartialEq<BigInt> for i32 {
fn eq(&self, other: &BigInt) -> bool {
num_bigint::BigInt::from(*self) == other.0
}
}
impl PartialEq<f64> for BigInt {
fn eq(&self, other: &f64) -> bool {
if other.fract() != 0.0 {
return false;
}
self.0 == num_bigint::BigInt::from(*other as i64)
}
}
impl PartialEq<BigInt> for f64 {
fn eq(&self, other: &BigInt) -> bool {
if self.fract() != 0.0 {
return false;
}
num_bigint::BigInt::from(*self as i64) == other.0
}
}