aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.rs
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2024-05-30 10:45:11 -0700
committerRose Hogenson <rosehogenson@posteo.net>2024-05-30 10:45:11 -0700
commit12febf6f88e62fd70cca1b7a87212dc8c0edb027 (patch)
treeb3d74e7b8dc52e663d056762203d57db48dc838c /src/eval.rs
parent0737a04aff503dcad59d2c0a0c26170fe932ae8c (diff)
downloadqc-12febf6f88e62fd70cca1b7a87212dc8c0edb027.tar.zst
Use i128.
Why not?
Diffstat (limited to 'src/eval.rs')
-rw-r--r--src/eval.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/eval.rs b/src/eval.rs
index f8f4c53..4d6ec80 100644
--- a/src/eval.rs
+++ b/src/eval.rs
@@ -2,11 +2,11 @@ use std::fmt::{Display, Formatter};
#[derive(Clone, Copy)]
pub enum Num {
- Int(i64),
+ Int(i128),
Float(f64),
}
-pub fn int(i: i64) -> Num {
+pub fn int(i: i128) -> Num {
Num::Int(i)
}
@@ -69,7 +69,7 @@ impl Num {
return int(q);
}
}
- int((self.as_float() / other.as_float()) as i64)
+ int((self.as_float() / other.as_float()) as i128)
}
pub fn modulo(self, other: Num) -> Num {
@@ -168,21 +168,21 @@ impl Num {
pub fn floor(self) -> Num {
match self {
Num::Int(i) => int(i),
- Num::Float(f) => int(f.floor() as i64),
+ Num::Float(f) => int(f.floor() as i128),
}
}
pub fn ceil(self) -> Num {
match self {
Num::Int(i) => int(i),
- Num::Float(f) => int(f.ceil() as i64),
+ Num::Float(f) => int(f.ceil() as i128),
}
}
pub fn round(self) -> Num {
match self {
Num::Int(i) => int(i),
- Num::Float(f) => int(f.round_ties_even() as i64),
+ Num::Float(f) => int(f.round_ties_even() as i128),
}
}