diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/eval.rs | 12 | ||||
| -rw-r--r-- | src/parser.rs | 2 |
2 files changed, 7 insertions, 7 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), } } diff --git a/src/parser.rs b/src/parser.rs index 0875d92..5e02037 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -53,7 +53,7 @@ impl<'a> Parser<'a> { }; return Some(eval::float(f)); } - let Ok(i) = i64::from_str(t) else { + let Ok(i) = i128::from_str(t) else { return None; }; Some(eval::int(i)) |
